Skip to content

Instantly share code, notes, and snippets.

@mjf
Created June 6, 2012 00:17
Show Gist options
  • Save mjf/2879051 to your computer and use it in GitHub Desktop.
Save mjf/2879051 to your computer and use it in GitHub Desktop.
par2ln.sed - join paragraphs lines with inverse indentation
#! /bin/sed -f
# par2ln.sed - join paragraphs lines with inverse indentation
# Copyright (C) 2012 Matous J. Fialka, <http://mjf.cz/>
# Released under the terms of The MIT License
# Input:
#
# foo
# bar
# baz
#
# Output:
#
# foo bar baz
:a
$! N
s/\n\([ \t]\+\)/ /
t a
P
D
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment