Last active
December 1, 2015 15:09
-
-
Save mitsuru793/8757e751fb76e34ab544 to your computer and use it in GitHub Desktop.
質問形式を整形。空行も自動で挟んでくれます。
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/bash | |
| # 【置換前】 | |
| # 〜ですか? | |
| # はいそうです。 | |
| # これは違うのでは? | |
| # いいえ、〜だからです。 | |
| # 【置換後】 | |
| # Q: 〜ですか? | |
| # はいそうです。 | |
| # | |
| # Q: これは違うのでは? | |
| # いいえ、〜だからです。 | |
| LF=$(printf '\\\012_') | |
| LF=${LF%_} | |
| pattern="^\(.*\)?$" | |
| replacement="Q: \1?" | |
| sed "s/$pattern/$LF$replacement/g" | sed 1d |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment