假设文件file.txt的内容如下所示.
1 This is the first line.
2 Hello, Everybody!
3 192.168.1.1 www.suda.edu.cn
4 lijunhui:x:504:504::/home/lijunhui:/bin/bash
写出如下两条命令的运行结果 :
(1) sed 's/suda//g' file.txt
(2) awk 'NR==2, NR==3 {print $1, $3}' file.txt
假设文件file.txt的内容如下所示.
1 This is the first line.
2 Hello, Everybody!
3 192.168.1.1 www.suda.edu.cn
4 lijunhui:x:504:504::/home/lijunhui:/bin/bash
写出如下两条命令的运行结果 :
(1) sed 's/suda//g' file.txt
(2) awk 'NR==2, NR==3 {print $1, $3}' file.txt
第一题答案:
1 This is the first line.
2 Hello, Everybody!
3 192.168.1.1 www..edu.cn
4 lijunhui:x:504:504::/home/lijunhui:/bin/bash
第二题答案:
2 Everybody!
3 www.suda.edu.cn