LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux 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

Reply
 
Search this Thread
Old 09-08-2009, 06:07 PM   #1
Jwood1988
LQ Newbie
 
Registered: Sep 2009
Posts: 2

Rep: Reputation: 0
Red Hat Academy Managing Files with File Globbing Online Exercises


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
 
Old 09-08-2009, 09:04 PM   #2
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.6, Centos 5.10
Posts: 16,324

Rep: Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041
I'd use ls |grep <pattern>, see http://www.robelle.com/smugbook/regexpr.html
 
Old 09-09-2009, 07:55 AM   #3
Jwood1988
LQ Newbie
 
Registered: Sep 2009
Posts: 2

Original Poster
Rep: Reputation: 0
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.
 
Old 09-09-2009, 08:41 PM   #4
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.6, Centos 5.10
Posts: 16,324

Rep: Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041
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...
 
  


Reply

Tags
files, globbing, online, redhat


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 egh128 Linux - General 0 03-18-2002 12:14 AM


All times are GMT -5. The time now is 05:10 PM.

Main Menu
Advertisement
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
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration