izy100
1
Anyone is well-versed to use egrep to search a file for a line containing both:
1) AAA
2) $
I am having problem escaping the dollar sign when using egrep in conjunction with satisfying AAA as well.
E.g. Text file
Line 1 AAA
Line 2 $$$
Line 3 AAA BBB $
Line 4 $$$ BBB AA
will return me
Line 3 AAA BBB $
Tks in advance.
cat filename
Line 1 AAA
Line 2 $$$
Line 3 AAA BBB $
Line 4 $$$ BBB AA
egrep '\$' filename | egrep 'AAA'
output:
Line 3 AAA BBB $
izy100
3
I am looking for a single statement.
E.g.
egrep '\$' + 'AAA' filename
So that if I need to exclude a statement with both search string, I can do a
egrep -v '\$' + 'AAA' filename
Anymore suggestions?