Sha256: 213b24fffa29d2a23b0431a37f011b0b16f7ed758712d88d71aad319689f5b4f
Contents?: true
Size: 643 Bytes
Versions: 1
Compression:
Stored size: 643 Bytes
Contents
#!/usr/bin/perl # This is a script for removing trailing whitespace from lines in files that # are listed on the command line. # This subroutine does the work for one file. sub detrail { my($file) = $_[0]; my($changed) = 0; open(IN, "$file") || die "Can't open $file for input"; @lines = <IN>; close(IN); foreach (@lines) { if (/\s+\n$/) { s/\s+\n$/\n/; $changed = 1; } } if ($changed) { open(OUT, ">$file") || die "Can't open $file for output"; print OUT @lines; close(OUT); } } # This is the main program $, = ""; # Output field separator for ($i = 0; $i < @ARGV; $i++) { &detrail($ARGV[$i]); } # End
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
esruby-0.0.0 | resources/mruby/build/mrbgems/mruby-regexp-pcre/pcre/Detrail |