Bash (Scripting) - do something pattern match

by
Jeremy Canfield |
Updated: March 08 2020
| Bash (Scripting) articles
Let's say file.txt contains the following text.
~]# cat file.txt
Hello
World
How
are
you
today?
The sed command can be used to print certain lines of the file. In this example, lines 1 through 3 and line 6 are printed.
~]# cat file.txt | sed -n -e 1,3p -e 6p
Hello
World
How
today?
Did you find this article helpful?
If so, consider buying me a coffee over at