Skip to main content
deleted 5 characters in body
Source Link
Steven D
  • 47.6k
  • 15
  • 123
  • 117

Sed Solution

$ sed -e ':a;N;$!ba;s/\(.\)\n\{1\}\n/\1 /g' -e 's/\n/\n\n/' test.text

Note, that in this solution :a is creating a label and not using the a command.

Replacing Multiple Spaces

Use tr: $ tr -s ' ' <test.text

Sed Solution

$ sed -e ':a;N;$!ba;s/\(.\)\n\{1\}/\1 /g' -e 's/\n/\n\n/' test.text

Note, that in this solution :a is creating a label and not using the a command.

Replacing Multiple Spaces

Use tr: $ tr -s ' ' <test.text

Sed Solution

$ sed -e ':a;N;$!ba;s/\(.\)\n/\1 /g' -e 's/\n/\n\n/' test.text

Note, that in this solution :a is creating a label and not using the a command.

Replacing Multiple Spaces

Use tr: $ tr -s ' ' <test.text

Post Undeleted by Steven D
Post Deleted by Steven D
Source Link
Steven D
  • 47.6k
  • 15
  • 123
  • 117

Sed Solution

$ sed -e ':a;N;$!ba;s/\(.\)\n\{1\}/\1 /g' -e 's/\n/\n\n/' test.text

Note, that in this solution :a is creating a label and not using the a command.

Replacing Multiple Spaces

Use tr: $ tr -s ' ' <test.text