Quote:
Originally Posted by pan64
I would use awk instead of grep:
Code:
awk ' /^Application Name:/ { n=$NF }
/^Status: Running/ { print n } ' filename
|
Hey
This was working fine for most of the cases. But recently we got a test case like below and it did not work accurately.
Sample data in file
<<Application Name: abc def_ghi/def_ghi/def_ghi
Service Name: abc_def_ghi.par
Deployment Status: Success
Service Instance Name: abc_def_ghi
Machine Name: abc00a0194
Status: Running>>
On running below code it is giving output as "def_ghi/def_ghi/def_ghi" rather than "abc def_ghi/def_ghi/def_ghi"
Code:
awk ' /Application Name:/ { n=$NF }
/Status: Running/ { print n } ' output.txt
Can you please suggest some modification in this awk command so that it displays the complete application name including the space?
thanks in advance.