SHIFT

--- Sjoerd Hooft's InFormation Technology ---

User Tools

Site Tools


sed
Differences

This shows you the differences between two versions of the page.

Link to this comparison view

sed [2013/05/18 09:27] (current)
sjoerd created
Line 1: Line 1:
 += Script: Sed: Search And Replace =
  
 +Basic sed search and replace line:
 +<​code>​
 +sed "​s/​$FIND/​$REPLACE/​g"​ $inputfile > /​tmp/​outputfile
 +</​code>​
 +
 +Code line to make email adresses unusable by adding the extension .local to the complete email address:
 +<​code>​
 +sed "​s/​^mail.*$/&​\.local/​g"​ inputfile > outputfile
 +</​code>​
 +* 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
 +
 +{{tag>​scripts}}
sed.txt ยท Last modified: 2013/05/18 09:27 by sjoerd