#I found this to be a bit tricky
sed -e '/pattern/i\
\ # <-- this is the key
' input_file > output_file
Showing posts with label sed. Show all posts
Showing posts with label sed. Show all posts
Monday, June 1, 2009
Inserting a blank line with sed
Friday, May 29, 2009
Removing carriage returns with sed
sed -e s/$'\r'/\ /g input_file # remove carriage returns
sed -e 's/\n/ /g' input_file # remove newlines
sed -e 's/\n/ /g' input_file # remove newlines
Insert text before a pattern with sed
cat some_file | sed '/pattern/i\
text to insert
' > output_file
text to insert
' > output_file
Subscribe to:
Posts (Atom)