sed¶
Resources¶
Inplace editing¶
Use -i
.
Print a range of lines¶
Use environment variables in sed¶
# sed -e "s/$WIKI_DIR\/docs/string_to_replace_with/" this doesn't work
sed -e 's@'"$WIKI_DIR/docs/"'@string_to_replace_with@'
sed -e "s|$WIKI_DIR/docs/|string_to_replace_with|"
Delete lines in a file¶
Delete lines that match a pattern¶
Remove nth line of stdin¶
Add closing tag to html tags¶
Add a character in the beginning of a line¶
Say I want to add #
in the begining of the first line.