4

I'm trying to replace this

colb,
cola,
)

with this

colb,
cola
)

in sed, but can't seem to get it to work. I've tried both of these but nothing seems to happen

sed -e  's/, \n)/\n)/g'

sed -e  's/,\n)/\n)/g'

I can get a new line to replace but I can't get a comma followed by a newline followed by ) to replace with just a newline followed by )

lightweight
  • 3,227
  • 14
  • 79
  • 142

1 Answers1

4

Extending on the solution from near-duplicate, this does work:

sed ':a;N;$!ba;s/,\n)/\
)/g'
Community
  • 1
  • 1
undur_gongor
  • 15,657
  • 5
  • 63
  • 75