0

I have a text file containing only text lines like this:

abcdefg
2009
hijklmnop
2012

I want to replace every second line-break with a comma. So it should look like this:

abcdefg, 2009
hijklmnop, 2012

How can I do this in TextWrangler?

mdcq
  • 1,593
  • 13
  • 30

1 Answers1

2

I've no idea what TextWrangler is but you haven't had an answer in about a day and you mention grep so maybe awk is an option to and if so it's trivially:

$ awk '{ORS=(NR%2?", ":"\n")}1' file
abcdefg, 2009
hijklmnop, 2012
Ed Morton
  • 188,023
  • 17
  • 78
  • 185
  • 1
    Thank you very much! That did it. Just to extend it for the rest, add this at the end of the line to save the output in a file: `> outputfile` – mdcq May 14 '15 at 21:39