sed - Streaming Editor

Sed One-Liners Explained

Löschen von E-Mail Adressen aus Mailinglisten

  for i in *; do sed '/helmuth@peer.st/d' -i $i;done

String aus allen .html Dateien ersetzen

find . -iname "*.html" -depth 1 -exec sed -i "" -e "s#Desktop/##g" {} \;

Umlaute in HTML Umlaute umwandeln

find . -name "*htm*" -exec sed -i 's/\([\ä\ö\ü\Ä\Ü\Ö]\)/\&\1uml\;/g;y/\ä\ö\ü\Ä\Ö\Ü/aouAOU/;s/\ß/\&szlig\;/g' {} \;

String in allen Dateien ersetzen

cd /etc/zypp/repos.d
for f in *.repo; do sed -i 's/11\.3/11.4/g' "$f"; done
sed -e "s@`cat /etc/fstab | grep home`@`cat /etc/fstab | grep home | sed -e 's/defaults/defaults,nolock/'`@g" /etc/fstab > /etc/fstab.neu; mv /etc/fstab /etc/fstab.bak; mv /etc/fstab.neu /etc/fstab
perl -p -i.old -e 's,^(baseurl=).*(/suse/.+)$,${1}http://ftp.halifax.rwth-aachen.de/packman${2}, if /^baseurl=.*packman\.inode\.at.*/' /etc/zypp/repos.d/*packman*.repo