Topic Contributors
creator avatar  
mreschke
Matthew Reschke
Site Developer
Created: Dec 6th, 2010
Updated: Sep 6th, 2011
File
Download Selected (zip)
Download Selected (tar.gz)
Edit
Select All
Select None
View
Detail
Detail Preview
Icons
Preview
Show Hidden
Hide Hidden
Full Manager
Reset Defaults
Open In New Tab
Open In New Window
List Archive Contents
Download File
Open
Download Folder (as .zip)
Sed Command
Post # 228 permalink Topic #226 by mreschke on 2010-12-06 17:40:02 (viewed 770 times)
Table of Contents

See Also Awk Command and Grep Command

One Liners[-][- -][++]

  1. Replace all occurrence's in a file (and write back to the same file)
    1. sed -i "s/this/withthis/g" /tmp/somefile
  2. Replace output newline (carriage return) with <br />
    1. sed ':a;N;$!ba;s/\n/ /g'
    2. emailbody="<h2>Your Directory</h2><pre>`/bin/ls -Rhal $yourdir|sed ':a;N;$!ba;s/\n/<br\/>/g'`</pre>"