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

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?

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




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




Comments

Web design by yours truely - me, myself, and I   |   jeremy.canfield@freekb.net   |