root/trunk/midgard/tools/yamp/clean_linefeeds.pl

Revision 6931, 306 bytes (checked in by bergie, 6 years ago)

Perl rename() doesn't work across filesystems

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
Line 
1 #!/usr/bin/perl
2
3 open FILE, "< $ARGV[0]";
4 open FILE2, "> /tmp/clean_linefeeds.$$";
5
6 while (<FILE>) {
7       s/\015\012/\012/; # Windows CRLF
8       s/\015/\012/;     # Mac CR
9       print FILE2;
10 }
11
12 close FILE;
13 close FILE2;
14
15 system("mv","/tmp/clean_linefeeds.$$", $ARGV[0]);
16 unlink("/tmp/clean_linefeeds.$$");
Note: See TracBrowser for help on using the browser.