I was trying to format a chat log for a friend that looks like this:
John Smith > hello Jane doe > hey how are you? John Smith > Pretty good thanks
and she wants to format it like this:
John Smith > hello
Jane doe > hey how are you?
John Smith > Pretty good thanks
Simply entering a new line after > is not good enough as it would not format correctly, so I need to insert a new line 3 white spaces, or 2 words prior to the ">" so the name is captured too.
So far I only have a new line after > :
/usr/bin/perl -p -i -e "s/>/>\n/g" *.txt
Edit: There are about 20+ different chat names involved so it would be great to do this without entering all their names since they may vary, and I'd like to learn from the exercise for fun. Thanks for reading