Quantcast
Channel: UNIX and Linux Forums
Viewing all articles
Browse latest Browse all 16232

Extract all text between the same matching string from a given column

$
0
0
Hello All,
I have an input sample data like below (In actual I have many columns and few million rows).
Code:

Column1,Column2
4,2
1,5
Hello,4
1,4
Hello,2
3,5
Hello,8
4,5

Need the output (using awk and/or sed preferably) like below. Here I need all the lines between 2 matching strings(inclusive) from a particular column (in this case, column 1) but the matching strings are the same ones "Hello".
Also preserve the header too.

Code:

Column1,Column2
Hello,4
1,4
Hello,2
3,5
Hello,8

Thanks
Sidda

Viewing all articles
Browse latest Browse all 16232

Trending Articles