I have a below file
RCS File name : abc.txt
something
something
....
symbolic names:
implemented : 1.1
ssssssumthing
Revision 1.2
date : 12/12/12 author : abc
Revision 1.1
date : 11/11/11 author xyz
So now , in this file i have to first look for the implemented version just after the symbolic names and then for that particular revision , find the author of the same.
Since its a continuous stream , i am using the output to my awk command.
I have written the below code to get the revision number but could not get the second thing
<input stream> | awk '/symbolic names/{getline;var = $2} /"revision",var/{getline;var = $2}'
Please advise
[akshay@nio tmp]$ cat file
something
something
....
symbolic names:
implemented : 1.1
ssssssumthing
Revision 1.2
date : 12/12/12 author : abc
Revision 1.1
date : 11/11/11 author xyz
[akshay@nio tmp]$ awk 'BEGIN{IGNORECASE=1}/symbolic names/{getline;i=$NF;r="revision.*"i}r && $0 ~ r{getline;print "Implemented",i,"on",$0}' file
Implemented 1.1 on date : 11/11/11 author xyz
[akshay@nio tmp]$ awk '/symbolic names/{getline;i=$NF;r="revision.*"i}r && tolower($0) ~ r{getline;print "Implemented",i,"on",$0}' file
Implemented 1.1 on date : 11/11/11 author xyz
Gawk
whatever_stream | awk 'BEGIN{IGNORECASE=1}/symbolic names/{getline;i=$NF;r="revision.*"i}r && $0 ~ r{getline;print "Implemented",i,"on",$0}'