Grep pattern and display all lines below

Hi I need to grep for a patter and display all lines below the pattern.

For ex: say my file has the below lines

file1
file2
file3
file4
file5

I NEED to grep for patter file3 and display all lines below the pattern. do we have an option to get this data. Let me know if you require any additional information on the same.

try

nawk '{A[++c] = $0} END { for ( i = 1; i <=c; i++ ) {if(A ~ "file3") {d++} { if ( d  == 1) print A[i+1]}}}' filename

Also

awk '/file3/{p++;next} p==1' filename

Try

sed -n '/file3/,$p' file
awk '/file3/{p=1}p==1' file 

?

He wants all line below pattern "file3" by your code it is displaying "file3" as well

1 Like

Try

awk 'p; /file3/{p=1}' file4
$ awk 'f; !f{f=/file3/}' <<EOF
file1
file2
file3
file4
file5
EOF

file4
file5