Match the value & print lines from the match

Hello,

I have a file contains two columns. I need to print the lines after �xxx� so i'm trying to match "xxx" & cut the lines after that. I'm trying with the grep & cut command, if there any simple way to extract this please help me.

Sample file :

name	id
AAA	123
AAB	124
AAC	125
AAD	126
xxx	xxx
ABS	654
ABO	785
ACC	754

expect output records :

ABS 654
ABO 785
ACC 754

Hello Shenbaga.d,

As your condition are very limited as per your input and post shown, following may help you in same then.

awk '{if(P=="xxx"){print}};{if($1=="xxx"){P="xxx"}}' Input_file
 

Following will be the output for same then.

ABS     654
ABO     785
ACC     754
 

Thanks,
R. Singh

Hi Ravinder,

i have tested and it is working as i expect.

Thank you very much!!

That could be simplified a bit to just:

awk 'P;$1=="xxx"{P=1}' file

As always, if you want to try this on a Solaris/SunOS system, change awk to /usr/xpg4/bin/awk .

Or even

awk 'P;/^xxx/{P=1}' file