1.需求:linux使用shell命令查询结果前后批量追加内容 例如:我需要在当前目录下所有的css文件路径前追加域名 我想的是用sed替换去实现,鲍哥的思路是用for循环 1.1方法1:鲍哥的for循环 这是鲍哥的思路,我写出来后,鲍哥说很二. for i in `find . -type f -name '*.css'`;do echo 'http://www.baidu.com/css/'$i;done 1.2方法2:sed替换 find . -type f -name '*.css'|s
例如,要想test.txt文件添加内容"I am a boy",test.txt在当前目录中 方法一:vi编辑法 打开终端,输入vi test.txt 回车,按a或i进入编辑模式,输入 I am a boy,然后按esc键退出编辑模式,输入:wq保存并退出. 方法二:echo命令法 打开终端,输入echo 'I am a boy' >> ./test.txt 注:追加单行文本法 方法三:cat命令法 cat >> ./test.txt <<EOF I