summaryrefslogtreecommitdiffstats
path: root/long-lines.pl
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xssn.at>2010-06-06 21:54:31 +0200
committerFlorian Pritz <bluewind@xssn.at>2010-06-06 21:54:31 +0200
commitcb9c6c194fd1a0aff05adbb36fc34e687920e190 (patch)
treeb785fba01953bc0c5140db5ededac713b5d33f7a /long-lines.pl
parent3af71ce2688435f8828b37257c0790f6300202b1 (diff)
downloadbin-cb9c6c194fd1a0aff05adbb36fc34e687920e190.tar.gz
bin-cb9c6c194fd1a0aff05adbb36fc34e687920e190.tar.xz
add long-lines.pl
Signed-off-by: Florian Pritz <bluewind@xssn.at>
Diffstat (limited to 'long-lines.pl')
-rwxr-xr-xlong-lines.pl32
1 files changed, 32 insertions, 0 deletions
diff --git a/long-lines.pl b/long-lines.pl
new file mode 100755
index 0000000..dc901ec
--- /dev/null
+++ b/long-lines.pl
@@ -0,0 +1,32 @@
+#!/usr/bin/perl
+use warnings;
+use strict;
+use File::Basename;
+use Getopt::Std;
+
+my %opt;
+getopts("hm:", \%opt);
+
+if (@ARGV == 0 || $opt{h}) {
+ print "usage: ", basename($0), " [options] file(s)...\n\n";
+ print "Options:\n";
+ print " -m NUMBER maximum chars tolerated per line\n";
+ print " -h this help\n";
+ exit 0;
+}
+
+my $max = 80;
+my $line = 0;
+
+$max = $opt{m} if ($opt{m});
+
+for my $file (@ARGV) {
+ open FILE,"<", $file;
+ $line = 0;
+ while (<FILE>) {
+ $line++;
+ if (length > $max) {
+ print "\"$file\" - line $line: ", length, " chars\n";
+ }
+ }
+}