Bash script to remove all lines in a text file untill a string Bash script to remove all lines in a text file untill a string shell shell

Bash script to remove all lines in a text file untill a string


You can do this easily with a Perl one-liner, which you can of course incorporate into a bash script.

$ perl -ne 'print if $ok; $ok=1 if /^house$/' sample.txt catdogetc


awk '    BEGIN                  { noprint = 1; cue = ARGV[1]; ARGV[1] = ""}    (!noprint)             { print }    (noprint && $0 == cue) { noprint = 0 }' house textfile