仅打印文件hello.txt的第3行,并用-----上下包围该行:$ sed -ne _____________ hello.txt-----This game is good-----
查看答案
对文件 hello.txt,把从包含"you"的行开始一直到文件结尾整个替换为"\nHave a nice day"$ sed -e '_______________________' hello.txtHello WorldHave a nice day
把所有偶数行替换为---seq 5 | sed '__________'1---3---5
在文件foo.txt的每两行之后添加来自文件address.txt的一行内容$ cat foo.txtbla bla 2015 blablah 2018 blahbla bla blacopyright: 2020$ cat address.txtstart address: 0xA0, func1 address: 0xA0end address: 0xFF, func2 address: 0xB0$ sed -n 'p' address.txt | sed -e '________________' foo.txtbla bla 2015 blablah 2018 blahstart address: 0xA0, func1 address: 0xA0bla bla blacopyright: 2020end address: 0xFF, func2 address: 0xB0
在文件address.txt的每一行前插入一行"---",并且在其后添加来自文件map.txt的一行。$ cat map.txt0xA0 0x50000xB0 0x60000xFF 0x7000$ sed ___________________ address.txt---start address: 0xA0, func1 address: 0xA00xA0 0x5000---end address: 0xFF, func2 address: 0xB00xB0 0x6000