bash - Grep Next Line and Modifying grep -


still stuck on one.

i need use grep search first line (issn) , should able output 0007-9235

<td nowrap valign="top" align="right"><b>issn:</b></td> <td valign="top"> 0007-9235 </td> 

i had issued issn=$(grep "issn:" $i -a1) , out put is

<td nowrap valign="top" align="right"><b>issn:</b></td> <td valign="top"> 0007-9235 </td> <td nowrap valign="top" align="right"><b>issn:</b></td> <td valign="top"> 0028-4793 </td> <td nowrap valign="top" align="right"><b>issn:</b></td> <td valign="top"> 0009-2665 </td> <td nowrap valign="top" align="right"><b>issn:</b></td> <td valign="top"> 0034-6861 </td> <td nowrap valign="top" align="right"><b>issn:</b></td> <td valign="top"> 0028-0836 </td> 

i need output 0007-9235, whole column below. please help, thank you!

you can pipe command cut:

grep -pzo '<td nowrap align="center" bgcolor="ffffe1"><p align="center">[^>]*>\k\d+(?:\.\d+)?' $i |   cut -d ' ' -f1-2 

or use awk:

grep -pzo '<td nowrap align="center" bgcolor="ffffe1"><p align="center">[^>]*>\k\d+(?:\.\d+)?' $i |   awk '{print $1, $2}' 

Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -