Created
June 26, 2012 13:15
-
-
Save OBdA/2995730 to your computer and use it in GitHub Desktop.
sed: collapse logical lines
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /bin/sed -f | |
| # SED script to concatenate logical lines sepaated by | |
| # backslashes (\) at the end of the "physical" line | |
| # set branch target 't' | |
| :t | |
| # apply the following on all lines ending with an '\' | |
| /\\$/ { | |
| # concatenate actual line with the next in pattern space | |
| N; | |
| # replace '\<newline' with nothing | |
| s/\\\n//; | |
| # branch to label 't' and go on... | |
| bt; | |
| } | |
| #EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment