Friday, 2 August 2019

Linux - What is sed

The command sed allows modifying and filtering text files.
sed ‘1,3 d’ test1.txt
The above command will display the lines after line 3. It will not display 1, 2, 3 lines of the test1.txt.
sed   ‘ s /abc / cab/’ test1.txt
The above command will substitute cab instead of abc in the test1.txt file.
sed  ‘s/one/1/’  test1.txt
The above command will substitute 1 instead of one in the test1.txt file.
sed ‘1,2 ! d’  test1.txt
This will only display line 1 and line 2.
Those are few examples for sed. Overall, sed allows users to perform filtering and searching.

0 comments:

Post a Comment