On Tuesday, Dec 2, 2003, at 21:06 Europe/Brussels, John W. Krahn wrote:
Jerry Rocteur wrote:Thanks very much for the answers on and off list.
Hi,
Hello,
I'm trying to use perl for most shell stuff and this is some of the stuff I'm using for grep ..
perl -ne 'print "$ARGV: $_" if /jerry/i ' * perl -ne 'print if /jer{1,}y/i ' * perl -ne 'print unless /jer{1,}y/i ' *
I'm enjoying this as I can do a lot more than I can with the old egrep on our Solaris boxes..
What I'd like to do is to make a simple change NOT to check in binary files and directories..
I've toyed with all sorts of variations and started like this.
perl -ne '-f &&print if /satreq/ ' * # Don't laugh this is one of very
many attempts ;-((
Then I tried this:
perl -ne 'if(/rcn/) {print "$ARGV: $_" unless -d}' *
Which seems to do the trick but this is just excluding directories I think..
But this gives me the same:
perl -ne 'if(/.it/) {print "$ARGV: $_" unless -f}' *
How do I improve it to ONLY look in text files ?
I don't want to use the grep.pl's around or the grep from power tools,
I want to impress the ladies by typing these on the CLI ;-)) Seriously,
I love one liners..
Something like this might work (untested):
perl -ne' close ARGV unless -f ARGV && -T _; print if /jer+y/i ' *
From: Steve Mayer <[EMAIL PROTECTED]> Jerry,
Shouldn't you just be able to plug it in as you did below with the -d and -f operators? Otherwise, you might be able to do something like this:
perl -ne 'if( -T $ARGV && /.it/) {print "$ARGV: $_"}' *
Steve
I like these two above and I'll be testing them both during the next few days to see which one works the best..
Thanks heaps,
Jerry
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]