lahaey.blogg.se

Linux edit text file in terminal
Linux edit text file in terminal








linux edit text file in terminal linux edit text file in terminal

The sed command is also great for stream editing. The p argument stands for print and is used to display the matched lines to the user.Įxecuting the aforementioned command on the example file produces the following output. You can also use the -quiet and -silent options instead of -n. The -n flag prevents sed from displaying the pattern space at the end of each cycle. To output the content between lines 3 and 5 of the file textfile.txt: sed -n '3,5p' textfile.txt But what if you want to get the content between two specific lines in a file? In such situations, the sed command might come in handy. Linux commands such as head and tail output the first or the last ten lines of a text file. This is the third general line in the file. It is an amazing file that will help us all. We will be using the following text file for demonstration in the post.










Linux edit text file in terminal