Scripting With sed

6 views
Skip to first unread message

hq4...@gmail.com

unread,
Mar 28, 2005, 8:31:24 AM3/28/05
to bash...@googlegroups.com
Scripting With sed

* Topics covered: global search and replace, input and output
redirection
* Utilities covered: sed

* Here's how you can use sed to modify the contents of a variable:

echo "Hello Jim" | sed -e 's/Hello/Bye/'

* Copy the file nlanr.txt to your home directory and notice how the
word 'vBNS' appears in it several times
* Change 'vBNS' to 'NETWORK' with

sed -e 's/vBNS/NETWORK/g' < nlanr.txt

* You can save the modified text in a file with output redirection

sed -e 's/vBNS/NETWORK/g' < nlanr.txt > nlanr.new

* Sed can be used for many complex editing tasks, we have only
scratched the surface here


http://users.sdsc.edu/~steube/Bshell/

Reply all
Reply to author
Forward
0 new messages