sed
Replace a word
$ echo "I like Ruby" | sed 's/like/love/' I love Ruby
$ sed 's/python/Ruby/' best_programming_language.txt
Remove a line containing specific string from a file
Output will actually go to another file, but this should be ok in most cases:
sed '/BINARY/d' sogo.marek_dump.sql > sogo.marek_dump.no_binary.sql
Replace a line in a file
This will replace each occurance of yourhostname with dignum.de:
sed -i 's/yourhostname/sogo\.dignum\.de/g' /etc/apache2/conf.d/SOGo.conf
Remove certain line from all files in a directory
Works with OSX sed.
sed -i '' /extend/d ../core/lib/monkey_patch/*.rb
Guides
sed.txt · Last modified: 2021/02/16 09:56 by 127.0.0.1
