Advertise on warmetal.nl!
Click for more information
about advertising here.

Did you find this website useful? Did I save you a lot of time?
Please consider donating to support this site:

 

Script: Sed: Search And Replace

Basic sed search and replace line:

sed "s/$FIND/$REPLACE/g" $inputfile > /tmp/outputfile

Code line to make email adresses unusable by adding the extension .local to the complete email address:

sed "s/^mail.*$/&\.local/g" inputfile > outputfile
  • s : substitute
  • ^mail : all lines that start with mail
  • .*$ : and match everything after the initial match
  • & : everything that has been matched
  • \.local : Add .local (\ is for escaping the '.')
  • g : global

Discussion

Enter your comment:
 
sed.txt · Last modified: 2010/10/25 17:13 by sjoerd