Sed

From CleanPosts

Jump to: navigation, search

Contents

Change double-spaces in a text file to single spaces

cat redpine.txt | sed 's/ \+/ /g' > redpine2.txt

Display all subdirectories in a tree format

ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\/]*\//----/g' -e 's/^//' -e 's/-/|/'

Prepend an asterisk to every line in a file

sed -ne 's/.*/* &/p' enterprise.txt > enterprise2.txt

Remove tags from HTML file

sed -e :a -e 's/<[^<]*>/ /g;/</{N;s/\n/ /;ba;}' CleanPosts.html

Personal tools
Strangers In Paradise