can be simplified to:
awk '/start_regex/,/end_regex/'
because in awk, if no action is given, the default action is to print the lines (that match the pattern). And if the pattern is omitted but the action is given, it means do the action on all lines of the input.
Edited to change:
print the line (that matches the pattern)
to
print the lines (that match the pattern)
Similarly
sed 15q
will print only the 1st 15 lines of the input and then terminate. E.g.:
sed 15q file
or
some_command | sed 15q
So, when put in a shell script and then called (with filename arg or using stdin):
sed $1q
is like a specific use of the head command [1]; it prints the first n ($1) lines of the standard input or of the filename argument given - where the value of $1 comes from the first command-line argument passed to the script.
[1] In fact on earlier Unix versions I worked on (which did not have the head command (IIRC), I used to use this sed command in a script called head - similar to tail.
And I also had a script called body :) to complement head and tail, with the appropriate invocation of sed. It takes two command-line arguments ($1 and $2) and prints (only) the lines in that line number range, from the input.
Couldn't agree more!
A great example of this was using (surprised it wasn't mentioned) sed with the -i & 's///g' operators while "cleaning" hundreds (seriously) of HTML/PHP files from injected content at a shared hosting provider.
I also learned recently that GNU Awk has networking support[5]. I have no idea why!
[1S] sed '1d'
[1A] awk 'NR!=1 {print}'
[2S] sed 's/foo/bar/'
[2A] awk '{sub(/foo/, "bar")}'
[3S] sed -n '/start_regex/,/end_regex/p'
[3A] awk '/start_regex/,/end_regex/ {print}'
[4] awk '$1=="foo" {print $5}'
[5] https://www.gnu.org/software/gawk/manual/gawkinet/gawkinet.h...