venerdì 8 agosto 2014

How search/and/replace in a file

The need is to change the paths in a text file to adapt the filepaths from a pc to another pc.

To do this the choose is to use the "sed"  command.

After a googling I find this hint:
http://stackoverflow.com/questions/525592/find-and-replace-inside-a-text-file-from-a-bash-command
In it there is this sample:
in the file "/tmp/file.txt" change all occurrence of "abc" to the new string "XYZ"

The start point is this hint

sed -i -e 's/abc/XYZ/g' /tmp/file.txt
 
from here

Nessun commento:

Posta un commento