Hi can someone please help me on this.
I need to perform this code:
Grep any lines that meets the following criteria
(A AND B) OR (A AND C)
I tried this code, but it didn't work
Grep-I "A &&B" | "A&&C" *.* [~/foldername]$
thanks in advance
Hi can someone please help me on this.
I need to perform this code:
Grep any lines that meets the following criteria
(A AND B) OR (A AND C)
I tried this code, but it didn't work
Grep-I "A &&B" | "A&&C" *.* [~/foldername]$
thanks in advance
you want this..
or... this..
here is an alternate way to do it with awk.
awk '/A/ && /B/ || /A/ && /C/' filename
try this also ...
egrep '(A)(B|C)' input_file
Regards
by the way i am using cygwin
awk '/A/ && /B/ || /A/ && /C/' filename didnt work
also
gawk '/A/ && /B/ || /A/ && /C/' filename didnt work
Basically any lines in the files that has A AND ( B OR C)
This is the input format
Line1 x y A
Line2 A z D
Line3 A B P
Line4 C A B
Desired output:
Line3 A B P
Line4 C A B
Many files and they are huge.. (200 to 300 Gbyes)
Is there any way that I can get the output in a most efficient (fast) way
Thanks
thanks , but egrep didnt work for me
error message " egrep is not recognized as an internal or external command"
could this be , due to cygwin??
ya i think in cygwin only simple grep works.....
The awk solution should work, try to place the and statements between parenthesis:
awk '(/A/ && /B/) || (/A/ && /C/)' filename
i need the file names as well .. awk command doesnt gives the file names it only prints the lines.
i have many inputfiles
i need something like grep -i (/A/ && /B/) || (/A/ && /C/) *.*[~/foldername]
did you tried the the solution given by me....
This will give you the filename. Works on my system. I don't have cygwin to test.
awk '/A/ && /B/ || /A/ && /C/{print FILENAME,$0}' filename
hi vidyadhar85
your soloution works with a single input file.
I have around 100 files all in one folder...
is there any way where i can ref. a folder name instead of file name?
thanks
you can specify any no of files in place of filename like filename or filename*
but change grep to grep -i to get filename in which desired pattern is present..