| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Examples of Using Meta Characters Meta character can be very useful when copying several files. Using that same file list to copy the files hat22 hat23 hat31 hat32 hat33 from the current directory to the directory /home/example, the command would be: cp hat[23]? /home/example In other words, this command will copy all files in the current directory that start with hat followed by the digits 2 or 3 with at least one additional character or number to the /home/example directory. The ? is required in this example to eliminate copying the file hat2 since it would meet all of the criteria up to the final ?. Meta characters can be used in any command argument that uses a file name. A command that would yield interesting results using the above example of file names is: more hat1? This would cause more to open initially the file hat11. When that was finished or quit, immediately the file hat12 would be sent to the screen, and then followed by the file hat13. Meta characters can be used to shorten the list of files displayed when using the ls command. Again using the same list of filenames, the command: ls -l hat[12][^3] would show the long form of the directory listing for only the files that start with the characters hat followed by a either the digits 1 or 2 and not followed by a 3. The result would then be a long listing for the files hat11 hat12 hat21 hat22 .
Home - Table Of Contents - Contact Us CertiGuide to A+ (A+ 4 Real) (http://www.CertiGuide.com/apfr/) on CertiGuide.com Version 1.0 - Version Date: March 29, 2005 Adapted with permission from a work created by Tcat Houser et al. CertiGuide.com Version © Copyright 2005 Charles M. Kozierok. All Rights Reserved. Not responsible for any loss resulting from the use of this site. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||