sed

sed

One advantage sed has over grep is replacement.
Match the
specified line to filter out the lines containing the yang character in test.txt. (There is no space before p)
sed
·
sed also supports symbols such as .* + in grep, but you need to add an escape character. If you don't want to add an escape character, you can add an r after -n.
With r
sed
·
without r, use scramble

sed
·
·
Print matching lines
Specify to print a certain line, and print the second line of test.txt.

sed
·
Select a range and print out lines 2-5 of test.txt.

sed
·
Print out the content after 20 lines of test.txt.

sed
·
Print out the entire contents of test.txt.

sed
·
List the first line of , and list the lines containing yang. (-e can then you do multiple operations in one command)

sed
·
List the lines containing yang characters (including uppercase) in test.txt. (add a capital i before p, which means case insensitive)

sed
·
·
Delete the specified line

Delete the first 20 lines of the test.txt file, the remaining line is line 21 (d is not really delete, just show the remaining lines.)

sed
·
Really delete the first 20 lines of the test.txt file, (-i really delete the file content)

sed
·
Delete by keyword, really delete the line containing yang in the test.txt file

sed
Replace Replace 1 - yang
in the last line is shuai. (and replace a writing in vim)

sed
·
Replace 1- ro, roo, rooo.. in the last line with r. (Character names can use regular expressions)

sed
·
In the first ten lines of test.txt, the lines separated by: , and the positions of the first and last paragraphs are exchanged.

sed
·
If there are special symbols in the characters to be replaced, you need to use escape characters, or use other separators (using @ or #).

sed
sed
·
Delete the letters in the first ten lines of the file. (Leave a space after the second slash to delete) The content of square brackets can be modified to numbers, single letters

sed
·
Add aaa: to the first ten lines of the file. (The content enclosed in parentheses can be represented by 1 or &)

sed
·

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324979880&siteId=291194637
sed