彩虹岛鬼武士耳环:熟悉UNIX/LINUX命令的朋友进来下

来源:百度文库 编辑:高考问答 时间:2024/04/18 14:30:27
Give the command to replace all occurrences of “john” with “John” in datafile

这个的命令是什么?

sed 's/老字符串/新字符串/g' datafile
s -- 替代命令 (command:replace)
g -- 全部 all occurrences)

sed 's/john/John/g' datafile

如果不要屏幕显示,而要存入新文件,后面加 re-direction , 即
sed 's/john/John/g' datafile > update_file