Find a text string in a file and output only the rest of the text that follows it?
Use awk
:
awk 's;/^three$/{s=1}' file
or
awk 's;$0=="three"{s=1}' file
s;
will print the line if variables
is true, which is the case first time after the pattern/word has been found .../^three$/{s=1}
will set variables
to true (1) if pattern/word is found.
With GNU sed
:
sed 0,/three/d
Note that Linux is a kernel, it doesn't have utilities. GNU sed
is the sed
implementation commonly found on GNU/Linux systems like Debian GNU/Linux. GNU sed
predates Linux and has been compiled to run on most Unix-like systems including most of those running Linux as their kernel. It is itself a Free, Libre and OpenSource re-implementation (with a few extensions including that 0
address) of the UNIX sed
utility from the late 70s.