sed search and insert

how can i modify a file using sed when searching
for a pattern and insert newline after the pattern?

pattern example: $ ...(any characters)...$

$ may082001.../tmp/msg.001,,$ REPT CLEAR ALARMS ON UNIT 1
$ may082001.../tmp/msg.002,,$ UNIT 1 IN SERVICE

into:

$ may082001.../tmp/msg.001,,$
REPT CLEAR ALARMS ON UNIT 1

$ may082001.../tmp/msg.002,,$
UNIT 1 IN SERVICE

I don't think you can use sed to do that, you will need to use "printf" to format a line.

Try awk and printf with sed. Try your sed statement then ; printf "\n". That should give you what you want.

Maybe Jimbo can help if he is monitoring for awk/sed threads...:smiley: