in reply to works on command line, but not from perl
Why don't you make it in perl instead of command line ?
There are more than one way to do it
my $file = 'text.txt'; open my $fh, '<' , $file or die $!; my @data = <$fh>; close $fh; print scalar @data;
If you still insisting on doing it through the command line then this might work
system( 'cat text.txt|wc -l| sed \'s/^[ \t]*//\'|sed \'s/[ \t]*$//\'' +);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: works on command line, but not from perl
by elwoodblues (Novice) on Feb 12, 2010 at 02:28 UTC | |
by graff (Chancellor) on Feb 12, 2010 at 02:59 UTC |