How can I replace a line which contains only -------- by |||
- by mimou
I have something like:
------------------------------------------------------------------------
r2 | username | 2011-01-16 16:52:23 +0100 (Sun, 16 Jan 2011) | 1 line
Changed paths:
D /foo
Removed foo
------------------------------------------------------------------------
r1 | username | 2011-01-16 16:51:03 +0100 (Sun, 16 Jan 2011) | 1 line
Changed paths:
A /foo
created foo
------------------------------------------------------------------------
My target is to identify the file added by the "username" in a specific date. Thus, I need to have the combination (username, 16 Jan 2011, A) to insure that it is the right file ands then print foo.
My idea is to:
delete the white spaces
change the newlines into |
get rid of the --------------- and replace them with newlines
but the problem is that I couldn't replace the ------- since they are mixed with other characters.
------------------------------------------------------------------------
|r2|username|2011-01-1616:52:23+0100(Sun,16Jan2011)|1line|Changedpaths:|D/foo|Removedfoo|
------------------------------------------------------------------------
|r1|username|2011-01-1616:51:03+0100(Sun,16Jan2011)|1line|Changedpaths:|A/foo|createdfoo|
------------------------------------------------------------------------
So I thought it would be a good idea to start by replacing the --------------- by a special character like ||| and then change this character by a newline using awk FS=||| OFS=\n
Can anyone help me!
thanks