File1:
Data will be inserted on Thursday
Messages has been sent at 6pm
Office hours is from 9am to 6pm
All the employees are present 输出我想要的:
DMS Data will be inserted on Thursday
DMS Messages has been sent at 6pm
DMS Office hours is from 9am to 6pm
DMS All the employees are present -或者-
输出我想要的:
Data will be inserted on Thursday DMS
Messages has been sent at 6pm DMS
Office hours is from 9am to 6pm DMS
All the employees are present DMS我想在文件的每一行中添加DMS这个词。它可以添加在第一或在线的末尾。
发布于 2015-08-02 10:50:17
试试这个,它会帮你的。在vi编辑器中打开文件:
$ vi /file/location
:1,100 s/^/DMS/ --> Enter 1,100正是您想要开始和结束的行。s是替换命令,^表示开始的行。或者您可以不打开文件就可以这样做,使用GNU:
sed -i 's/^/DMS /' /your/file/locationhttps://unix.stackexchange.com/questions/219732
复制相似问题