Okay so I can’t figure this out. Like a file that I using grep in order to get certain information has it set-up like this.
#aaaa
<numbers 123456>
blah
blah
blah
#bbbb
<numbers 2156488>
blah
blah
blah
#cccc
<numbers 5478624>
blah
blah
blah
What I am doing is I am greping for aaaa or bbbb or cccc and the information that i really need is the numbers. As in when i grep for aaaa the thing i want to obtain is really just the numbers right below it. In this case it would 123456
I know how to grep for aaaa but i don’t know how to go to the next line and cut the number.
You can use the
-Coption ofgrepto show one line of context. Then you cantailon the last line (-n 1),cutusing spaces and selecting the second field,cutagain using>and selecting the first field. Thus:will give back the number you’re requesting.
The most important part is the
-Coption ofgrep