Here are a few common uses for completing filenames with wild cards. I will demonstrate the "*", "?", and "[]" wild card options.
The asterisk, "*", represents any sequence of characters.
Prints all files that end with "2007.txt" eg. file12007.txt, file22007.txt, etc.
#lp *2007.txt
Prints all files that end with "txt" in the current directory
#lp *txt
Removes everything in the current directory (BE CAREFUL!)
#rm *
#rm -i * (interactive)
List all files that have "Feb" in its filename
#ls -l *Feb*
The question mark, "?", represents one character.
Print all documents in the current directory that contains report.1(any single character).txt eg. report.2a.txt, report.20.txt, report.21.txt, etc.
#lp report.2?.txt
#cp -p report1?.txt archive
The brackets, "[]", represent one character within a range.
Print all documents in the current directory that contains report.1[any character in a range].txt eg. report.20.txt, report.21.txt, report.29.txt.
#lp report.2[0-9].txt
#cp -p report1[0-9].txt archive
#rm report1[0-9].txt
This blog covers Unix system administration HOWTO tips for using inline for loops, find command, Unix scripting, configuration, SQL, various Unix-based tools, and command line interface syntax. The Unix OS supports tasks such as running hardware, device drivers, peripherals and third party applications. Share tips/comments. Read the comments. But most importantly: Read Disclaimer - Read Disclaimer.
1 comment:
Unix Geeks Represent on Stanford Campus in "nerdcore 4 life" .
Post a Comment