in reply to dos2ux shows cannot open file if it is greater than 2GB size
perl -pi -e 's/\r\n/\n/' file.raw
which is essentially short for
#!/usr/bin/perl use strict; use warnings; use File::Temp qw/ tempfile /; use File::Copy; my ($out, $filename) = tempfile("$ARGV[0]_XXXX", UNLINK => 0); open my $in, '<', $ARGV[0] or die "Open failed: $!"; while (defined(my $line = <$in>)) { $line =~ s/\r\n/\n/; print $out $line; } close $in; close $out; move($filename, $ARGV[0]);
See -e, -p and -i in perlrun, and review perlretut for details on regular expressions.
#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: dos2ux shows cannot open file if it is greater than 2GB size
by ikegami (Patriarch) on Mar 13, 2013 at 17:44 UTC | |
by shan_emails (Beadle) on Mar 14, 2013 at 14:45 UTC | |
by kennethk (Abbot) on Mar 14, 2013 at 17:25 UTC | |
by ikegami (Patriarch) on Mar 14, 2013 at 23:11 UTC | |
by Tux (Canon) on Mar 15, 2013 at 07:34 UTC | |
by ikegami (Patriarch) on Mar 16, 2013 at 18:43 UTC | |
|