I would like to create a sed command that takes every two lines in a document

and if the first line ends with [letter or number] and the second line contains dot (.) it will join these two lines together.

Is it possible with sed?

  • 3
    When asking this type of question, please make sure to include example input and output so we can understand what you need. – terdon Apr 10 '15 at 16:58

Much better if you show example input and desired output but in first close:

sed ':1;N;/\w\n/{s/\n\([^\n]*\.\)/ \1/;t1};P;D'
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.