LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux > Linux - Newbie
User Name
Password
Linux - Newbie This forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Tags used in this thread
Popular LQ Tags , , , , , , ,

Reply
 
Thread Tools
Old 09-08-2009, 06:07 PM   #1
Jwood1988
LQ Newbie
 
Registered: Sep 2009
Posts: 2
Thanked: 0
Red Hat Academy Managing Files with File Globbing Online Exercises


[Log in to get rid of this advertisement]
From /usr/share/tcl8.4/encoding directory

Copy all files whose first four characters are composed of exactly three letters followed by a number into the directory xxxn

I have tried like every command i can think of just to get three letters and followed by any numbers
i've tried cp /usr/share/tcl8.4/encoding/???[a-z]*[0123456789].*
and a bunch of others but they either bring cp855 which is only two letters or just straight letters i need Help

thanx in advance and to think this is only Workbook 2 in linux class i'm in trouble
windows_xp_2003 Jwood1988 is offline  
Tag This Post , , , , , , ,
Reply With Quote
Old 09-08-2009, 09:04 PM   #2
chrism01
Guru
 
Registered: Aug 2004
Location: Brisbane
Distribution: Centos 5.4
Posts: 7,428
Thanked: 325
I'd use ls |grep <pattern>, see http://www.robelle.com/smugbook/regexpr.html
windows_xp_2003 chrism01 is offline     Reply With Quote
Old 09-09-2009, 07:55 AM   #3
Jwood1988
LQ Newbie
 
Registered: Sep 2009
Posts: 2
Thanked: 0

Original Poster
Solution

Chris Thanx for the reply but i'm in the beginning of learning Linux and we have not got to the grep command so i really couldn't figure it out i'm still really new

Okay i finally figured it out to list the results from the directory /usr/share/tcl8.4/encoding/
that contain three letters followed by a number i typed the command
cp /usr/share/tcl8.4/encoding/??[a-z][0-9]*.enc ~/xxxn/

This is the online Exercise Answer For the last one in Workbook 2 Chapter 5.
windows_xp_2003 Jwood1988 is offline     Reply With Quote
Old 09-09-2009, 08:41 PM   #4
chrism01
Guru
 
Registered: Aug 2004
Location: Brisbane
Distribution: Centos 5.4
Posts: 7,428
Thanked: 325
Quote:
The asterisk -- * -- matches any number of repeats of the character string or RE preceding it, including zero.
http://www.faqs.org/docs/abs/HTML/regexp.html

That's not 'exactly three letters followed by a number' unless by number they don't mean digit (which it sounds like they do in fact want).
You need some carefully named test files eg

a1
ab2
abc3
abcd4
abc67
ab678
89a
89abc

Only one of these matches the requirement...
windows_xp_2003 chrism01 is offline     Reply With Quote

Reply

Bookmarks


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Red Hat - VSFTP Server - release of large files to the file store houmb17 Linux - General 4 02-29-2008 06:02 AM
Is there a file size limitation for transfering files in Red Hat ES 4? rdelia Linux - Newbie 10 03-15-2007 06:08 PM
problem: online on winxp and linux red hat gemini_shooter Linux - Newbie 5 05-29-2005 10:40 PM
Ultima Online in Red Hat 7.2 kernal Linux - General 0 03-18-2002 12:14 AM


All times are GMT -5. The time now is 09:29 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
RSS2  LQ Podcast
RSS2  LQ Radio
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration