I want to print all lines from file until the match word
please advice how to do that with awk
for example
I want to print all lines until word PPP
remark the first line chuld be diff from AAA ( any word )
cat file.txt
AAA ( the first line/word chuld be any word !!!!! )
BBB
JJJ
OOO
345
211
BBB
OOO
OOO
PPP
MMM
(((
&&&
so I need to get this
AAA
BBB
JJJ
OOO
345
211
BBB
OOO
OOO
PPP
other example ( want to print until KJGFGHJ )
cat file.txt1
HG
KJGFGHJ
KKKK
so I need to get
HG
KJGFGHJ
Best Answer
Try: