Skip to content

Instantly share code, notes, and snippets.

@south-str
Created June 3, 2018 16:36
Show Gist options
  • Save south-str/d458b911d4c3fdf958346069db4071e7 to your computer and use it in GitHub Desktop.
Save south-str/d458b911d4c3fdf958346069db4071e7 to your computer and use it in GitHub Desktop.
CRLFをLFに置換し、LFで終わる連続した行を結合して1行にするsedスクリプト(Mac, BSD用)
{
# 制御文字はダメっぽいので^Mで代用する
/^M$/!b loop
/^M$/s/^M//g
b done
:loop
N
/^M$/!b loop
s/\n//g
p
:done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment