Tuesday, December 6, 2011

Grep for multiple words

grep 'A\|B' file
A B C D
B C D E
ubuntu1004@ubuntu1004:~$ cat -n file
     1 A B C D
     2 B C D E
     3 F G H I
     4 G I R T
ubuntu1004@ubuntu1004:~$ grep -rn 'A\|B' file
1:A B C D
2:B C D E

No comments:

Post a Comment