use regexp to insert newline within a line

I have successfully used regexp and sed to insert a newline before or after a line containing a matched pattern /WORD/. However, I want to insert a newline immediately following /WORD/ and not after the -line- containing the pattern matched. I can match a pattern, but it is matched via a wild card as follows /..:..:..:..:..:..:..:../ This pattern is a series of 8 random bytes each seperated by a colon. I dont want to delete or change the pattern match, I want only to insert a \n after that.

Try this assuming your sed version supports '\n' as a newline:

sed 's/\(.*\)\(..:..:..:..:..:..:..:..\)\(.*\)/\1\2\n\3/' file

Otherwise (2 lines !):

sed 's/\(.*\)\(..:..:..:..:..:..:..:..\)\(.*\)/\1\2\
\3/' file

Regards

Wow! Thanks so much! I never thought to look at it that way!
Ken
:slight_smile: