Artificial intelligent assistant

Extract two lines following a line with a specific value I have a text file and I would like to extract the two lines of data following a line containing only "Name" as a value. > Name > > 032 > > Express intent to engage in diplomatic cooperation (such as policy > > support) > > Description > > Name > > 033 > > Express intent to provide material aid, not specied below > > Description So, the output from above would be a file that has: > 032 Express intent to engage in diplomatic cooperation (such as policy support) > > 033 Express intent to provide material aid, not specified below

awk '/Name/ { readline; num=$0; readline; print num, $0; }' < inputfile


`readline` reads the next line of the input into `$0`. So when `Name` is matched, it reads the next line, puts it into the `num` variable, then reads the second line, and then prints `num` and that line together on one line.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy a7d7b7467b043725bfe2ed01d10afc98