Send As SMS

Tuesday, August 02, 2005

CLI Magic: Regular Expressions & Metacharacters

Another entry in Linux.com's CLI Series shows you some basic and somewhat advanced examples of using regular expressions to make life easier.

Suppose you need to search a text file for two similar words -- let's say "Linux" and "Linus." You might run two separate greps, or use the grep -e option (grep -e Linux -e Linus). But a better way might be to use the square brackets metacharacters:

grep Linu[sx] myfile.txt

0 Comments:

Post a Comment

<< Home