Hi
I have the following output
Message man amm (9196) is calling
Hello & Alert man amtrr (9197) is stopped
Find amfi (19198) is cancelled
Engine Item aea (19203) is notified
Engine Item2 aea2 (19204) is notified
I need to print only the column which contains amm,amtrr,amfi,aea & aea2
in awk $3 does not give 3rd line i.e amfi.... The clue is the items i need to print starts with 'a'
Assuming the pattern is always before the field between the parentheses:
sed 's/.* \(.*\) (.*/\1/' file
no,
I do have brackets before the pattern
That's what I mean, have you tried the command?
i also have down the file like
Req Har omrh (2254) is terminating
MR Rect (MRRT) omrrt (2255) is concluding
DR Rect (DRRT) omrdt (2256) is concluding
Have you tried the command?
yes, the first half of the output is empty and then one line with the correct word printed and the blank output.
In simple terms, I need to print the word which starts with a letter 'o' for each line.
<---Only one word in each line which starts with letter 'o' . That word could be anywhere in the line i.e $1 or $2 or $3 or $4--->
prasannaks:
yes, the first half of the output is empty and then one line with the correct word printed and the blank output.
In simple terms, I need to print the word which starts with a letter 'o' for each line.
<---Only one word in each line which starts with letter 'o' . That word could be anywhere in the line i.e $1 or $2 or $3 or $4--->
awk '{for(i=1;i<=NF;i++){if($i ~ "^o"){print $i}}}' file
worked fine. Thanks Franklin.