- s - substitute
- i - insert
- a - append
- d - delete
- sed -f sample.sed file.txt
- sed 's/^night/day/'
- sed 's/ $//' - Replace space at end of line
- sed 'X,$d' file.txt
Remove all white space from beginning of line
echo " This is a test" | sed -e 's/^[ \t]*//'
Edit a file in place:
- sed -i 's/BOB/JANE/' file.txt
Removing most things in between ( and ) in a file
- sed 's/([a-z,A-Z,0-9,+*!]*)//g'
sed '/^$/d'
Remove everything except the number one....
sed 's/[^1//g'
No comments:
Post a Comment