Monday, November 22, 2010

Introductory Unix Globbing Help?

Question from Homework:



How would you list all files in the elements directory that either start with the ';c'; character, or end with the ';m'; character, or both. (hint, you may need to use more than one globbing pattern on the same command line)?



I currently have ';ls c* m* c*m'; but this creates duplicates. I'm not sure if that's wrong but if there is a better way I would appreciate it.



2nd Question:

Change directory to /usr/local/lib/glob. Look at the contents of the two directories inside of glob. Without changing directories, how would you list all files in example01 and example02 that DO NOT end in a 5, 6, 7, 8, or 9? What is the minimum number of characters you can use for this command?



Don't even know where to start on this one.



Thanks for the help!Introductory Unix Globbing Help?
Have a look at the following page which describes globs:

http://linux.about.com/od/lts_guide/a/gd



It has some examples including one which you could easily adapt to handle the c* and *m example.



It looks like it includes the part to filter out the 5,6,7,8,9.

No comments:

Post a Comment