Click here to get back home

perl command line help

 HomeNewsGroups | Search | About
 comp.lang.perl.misc    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
perl command line help Ray Muforosky 06-05-2008
Get Chitika Premium
Posted by Ray Muforosky on June 5, 2008, 12:09 pm
Please log in for more thread options
assuming fileA contain the data below could help with this

perl -lane '$l=$_, ($a,$b,$c,$d)= split(/\./,$F[0]),print $d' fileA

fileA
===
192.68.45.718 daskjaskjf asdfjkasjf asfkasfklh
192.68.34.62 ADKDAK Dkkslaslk jjsdkdldj
192.68.23 INEED HELP PLEASE
192.68.67.4 dkasdfkl kasfkasfkakf
192.68.4.97 flaskfk asfkfafv asf

How do I modify the command line code above to get this below : print
lines where the last quadrant is even

123.68.45.718 daskjaskjf asdfjkasjf asfkasfklh
192.68.34.62 ADKDAK Dkkslaslk jjsdkdldj
192.68.67.4 dkasdfkl kasfkasfkakf


Thanks
Any other ideas will be appreciated.

Posted by Jürgen Exner on June 5, 2008, 12:17 pm
Please log in for more thread options
>How do I modify the command line code above to get this below : print
>lines where the last quadrant is even
>
>123.68.45.718 daskjaskjf asdfjkasjf asfkasfklh
>192.68.34.62 ADKDAK Dkkslaslk jjsdkdldj
>192.68.67.4 dkasdfkl kasfkasfkakf

Exactly the same way as is currently being discussed in the thread
"regex back matching" which _YOU_ started.
Why are you kicking off another thread with the identical topic while
there are still open question in the first one? Do you want to
re-discuss the same old questions again?

jue

Posted by Ted Zlatanov on June 5, 2008, 1:29 pm
Please log in for more thread options

>> How do I modify the command line code above to get this below : print
>> lines where the last quadrant is even
>>
>> 123.68.45.718 daskjaskjf asdfjkasjf asfkasfklh
>> 192.68.34.62 ADKDAK Dkkslaslk jjsdkdldj
>> 192.68.67.4 dkasdfkl kasfkasfkakf

JE> Exactly the same way as is currently being discussed in the thread
JE> "regex back matching" which _YOU_ started.
JE> Why are you kicking off another thread with the identical topic while
JE> there are still open question in the first one? Do you want to
JE> re-discuss the same old questions again?

Obviously the IPs in this thread are in SI units, the other one was for
Americans ;)

Ted

Posted by dummy on June 6, 2008, 7:13 pm
Please log in for more thread options
On Thu, 5 Jun 2008 09:09:12 -0700 (PDT), Ray Muforosky

>assuming fileA contain the data below could help with this
>
>perl -lane '$l=$_, ($a,$b,$c,$d)= split(/\./,$F[0]),print $d' fileA
>
>fileA
>===
> 192.68.45.718 daskjaskjf asdfjkasjf asfkasfklh
> 192.68.34.62 ADKDAK Dkkslaslk jjsdkdldj
> 192.68.23 INEED HELP PLEASE
> 192.68.67.4 dkasdfkl kasfkasfkakf
> 192.68.4.97 flaskfk asfkfafv asf
>
>How do I modify the command line code above to get this below : print
>lines where the last quadrant is even
>
>123.68.45.718 daskjaskjf asdfjkasjf asfkasfklh
>192.68.34.62 ADKDAK Dkkslaslk jjsdkdldj
>192.68.67.4 dkasdfkl kasfkasfkakf
>
>
>Thanks
>Any other ideas will be appreciated.

perl -ne "print if /(\d+\.)\d[02468]\s/" FileA.txt

Similar ThreadsPosted
use one line Perl command to add a line at the begin of a file December 13, 2005, 3:25 pm
Where's the doc. on perl command-line options? August 31, 2004, 1:14 am
[Q] $ARGV, <>, and command-line Perl December 16, 2004, 6:43 pm
Perl Command line for this problem March 21, 2005, 3:31 pm
can't run perl commands from command line July 28, 2005, 6:08 am
perl command line arguements November 9, 2006, 8:45 pm
.gz and .bz2 files on the Perl command line August 5, 2008, 5:11 pm
FAQ: Can I write useful Perl programs on the command line? October 12, 2004, 5:10 am
FAQ 3.25 Can I write useful Perl programs on the command line? January 22, 2005, 12:03 am
FAQ 3.24 Can I write useful Perl programs on the command line? April 11, 2005, 5:03 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap