2

I have this kind of file:

{...}
{...}
{...}
{...}

And I want it to look like this:

{...},
{...},
{...},
{...},

How can I do this with Linux/Unix tools? Thanks

John Hascall
  • 8,925
  • 4
  • 48
  • 66
Joan Triay
  • 1,362
  • 6
  • 17
  • 33

1 Answers1

7

Transferring my comment to an answer.

You can use:

sed 's/$/,/' file

Or for inline editing of the file:

sed -i '' 's/$/,/' file

$ will match end-of-line in each line.

anubhava
  • 713,503
  • 59
  • 514
  • 593