I need to replace a string in a lot of files in a folder, with only ssh access to the server. How can I do this?
for example i want replace all files Which contains code
<script src='http://cdn.adplxmd.com/adplexmedia/tags/xbanner/xbanner.js?ap=1300' type='text/javascript'></script>
I want replace it with my name: sultan
I do something like this:
sed -i 's/<script src='http://cdn.adplxmd.com/adplexmedia/tags/xbanner/xbanner.js?ap=1300' type='text/javascript'></script>/sultan/g' *
but the problem i see error message in linux commands:
sed: -e expression #1, char 20: unknown option to `s'
How do I fix this problems?
There are two errors:
You can try something like this instead:
sed -i "s|<script src='http://cdn.adplxmd.com/adplexmedia/tags/xbanner/xbanner.js?ap=1300' type='text/javascript'></script>|sultan|g" *
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.