fork download
  1. #!/bin/bash
  2. s='Alice
  3. Smith
  4. Bob Doolittle
  5. Mark
  6. Von Doe //sometimes, there are more than one word on the next line'
  7. sed -E '/^[^[:space:]]+$/{N;s/\n/ /}' <<< "$s"
Success #stdin #stdout 0s 4996KB
stdin
Standard input is empty
stdout
Alice Smith
Bob Doolittle
Mark Von Doe //sometimes, there are more than one word on the next line