Bootstrap FreeKB - Bash (Scripting) - do something pattern match
Bash (Scripting) - do something pattern match

Updated:   |  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 Buy Me A Coffee



Comments


Add a Comment


Please enter 9f7992 in the box below so that we can be sure you are a human.