Sed
From Leo's Notes
This page was last edited on 12 June 2013, at 22:49.
Simple search / replace
sed 's/<search>/<replace>/g'
Remove HTML tags
sed -e 's/<[^>]*>//g' <file>
Remove File Extensions
sed 's/\(.*\)\..*/\1/'
eg:
echo "house.txt" | sed 's/\(.*\)\..*/\1/' # returns 'house'
Delete Matching Line
sed '/someline/d'
Modifying a File Directly
Using the above tips, you can modify a file directly by using the -i parameter, with the filename as the second argument:
sed -i "search" /path/to/file