Created
July 7, 2011 07:52
-
-
Save froop/1069063 to your computer and use it in GitHub Desktop.
[bsh] 複数ファイルの内容を一気に書き換えるシェルスクリプトのサンプル for Cygwin
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
| mkdir result | |
| for FILE in *.txt; do sed -e '1,3d' -e 's/\b9999\b/0001/g' -e '/^REM\b/d' $FILE > result/$FILE; unix2dos result/$FILE; done | |
| # カレントディレクトリの「*.txt」ファイルが対象 | |
| # 「-e '1,3d'」1行目から3行目を削除 | |
| # 「-e 's/\b9999\b/0001/g'」正規表現に合致する文字列を置換 | |
| # 「-e '/^REM\b/d'」正規表現に合致する行を削除 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment