Hello,
Thanks in advance for the query.
There is a log file abcd.log which has multible line like this.
"hello1" , "hello2", "hello3" , "hello4" , "hello5"
I want to grep for the lines which has "hello4" & "hello5" and use "hello2" to grep the same log file again.
All these should happen on the fly.
How do I grep using a string in the result I get here.
Please show part of your input data and the desired output.
This is my log file.
"hello1" , "hello2", "hello3" , "hello4" , "hello5"
"hello1" , "hello6", "hello7" , "hello8" , "hello9"
"hello1" , "hello12", "hello13" , "hello14" , "hello15"
"hello1" , "hello22", "hello23" , "hello24" , "hello25"
"hello2" & "hello3" are the string which I will know in advance before the log is generated.
My output should contain "hello1"
---------- Post updated at 04:25 PM ---------- Previous update was at 04:22 PM ----------
I actually figured it out.
Here it is.
oky
4
Try this
awk '/hellox/ && /helloy/' <filename.txt> | awk '{ print $1 }'
rdcwayx
5
why not put in one awk?
awk '/hellox/ && /helloy/ {print $1}' <filename.txt>
oky
6
ofcourse rdcwayx you are correct, i didn't noticed that ..thx for your input
Both dint work .. Got this error
ctsgnb
8
nawk '(/hello2\"/&&/hello3\"/){p=$1}($1~p)' infile
rdcwayx
9
Use nawk or /usr/xpg4/bin/awk in Solaris