(Replace string1 with string2)
2. #sed 's/\(.*\)1/\12/g'
(Modify anystring1 to anystring2)
3. #sed '/ *#/d; /^ *$/d'
(Remove comments and blank lines)
4. #sed ':a; /\\$/N; s/\\\n//; ta'
(Concatenate lines with trailing \)
5. #sed 's/[ \t]*$//'
(Remove trailing spaces from lines)
6.# sed 's/\([`"$\]\)/\\\1/g'
(Escape shell metacharacters active within double quotes)
7.#seq 10 | sed "s/^/ /; s/ *\(.\{7,\}\)/\1/"
(Right align numbers)
8.#sed -n '1000p;1000q'
(Print 1000th line)
9.#sed -n '10,20p;20q'
(Print lines 10 to 20)
10. #sed -n 's/.*
(Extract title from HTML web page)
11. #sed -i 42d ~/.ssh/known_hosts
(Delete a particular line)
No comments:
Post a Comment
tag ur valuable ideas below