Created
December 28, 2013 10:20
-
-
Save note103/8158039 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
| #!/usr/bin/env perl | |
| use strict; | |
| use warnings; | |
| open (FILE, 'buffer.txt'); | |
| my @lines = <FILE>; | |
| for my $line (@lines) { | |
| if ($line =~ /\[(.+)\]\[(.+)\]/) { | |
| print "$1, $2\n"; | |
| } elsif ($line =~ /\[(.+)\]/) { | |
| print "$1\n"; | |
| } else { | |
| print "$line"; | |
| } | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
なんでelse以外では\nが必要だったのか自分で分からなかったけど、読み込んだファイルがすでに改行込みのデータだったから、ママで出力する最後だけ改行不要だったのか