sed the simple use of a small mind

Replace the contents of a character string of the file a line of
document 1, the jack string containing the current directory, jack string with Tom
Sed -i "S / jack / Tom / G" `grep" jack "-rl. / '
2, the jack string to replace a file Tom
Sed -i "S / jack / Tom / G" test.txt

Before or after the line of a row line by adding a line
Sed -i '/ testafter / A \ Testing' test.txt
Sed -i '/ testbefore / I \ Testing' test.txt

In a row (refer to a specific line number) before or after adding a single line
Sed -i 'N;. 4A \ ddpdf' a.txt
Sed -i 'N; 4i \ eepdf' a.txt
delete or next row specified in the row ?

Guess you like

Origin www.cnblogs.com/ppp1314520818/p/11353404.html
Recommended