SED @ explanation
I have come across this statement when I am learning the tutorial from this website http://www.magiclinux.org/node/895
#gcc -dumpspecs | sed 's@/lib/ld-linux.so.2@/tools&@g' \ > `dirname $(gcc -print-libgcc-file-name)`/specs What is the s@/lib/ld-linux.so.2@/tools&@g stands for? I know that if s/color/colour/g means change all color to colour. But there is an @ in the statement? Thank you. |
Hi,
The seperator that is normally used (the /) can be anything you like in sed. s/xxxx/yyyy/g is the same as s@xxxx@yyyy@g This way you do not need to escape the slashes in the pathname (/lib/ld-linux instead of \/lib\/ld-linux). Hope this clears things up a bit. |
You can use any delimiter you want in a sed expression; it will use whatever follows the s (in this instance) as the delimiter. So, the following are synonymous:
Code:
sed 's@/lib/ld-linux.so.2@/tools&@g' Code:
sed 's/\/lib\/ld-linux.so.2/\/tools&/g' |
Thanks so much for the explanation. Now I am totally clear of it.
|
All times are GMT -5. The time now is 08:48 AM. |