Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: search for chr() fails

by Anonymous Monk
on May 21, 2013 at 00:40 UTC ( #1034431=note: print w/ replies, xml ) Need Help??


in reply to search for chr() fails

Use this so we can see what data you have

perl -MData::Dump -MFile::Slurp -e " dd scalar read_file shift, { qw/ +binmode :raw / }; " hitters > ThatFilesBytesAsPerlAsciiCode.pl

Try perl -CSD -e ... and see perlrun , print Delta symbol, Upside Down Text Revised, perlunitut


Comment on Re: search for chr() fails
Select or Download Code
Re^2: search for chr() fails
by tbone654 (Beadle) on May 21, 2013 at 01:57 UTC
    OQ91@BBCPC36662 /cygdrive/c/package $ perl -MData::Dump -MFile::Slurp -e " dd scalar read_file shift, { qw +/ binmode :raw / }; " hitters > ThatFilesBytesAsPerlAsciiCode.pl <br>thanks to your code I can tell the search string I'm looking for i +s \xAO<br> OQ91@BBCPC36662 /cygdrive/c/package $ cat ThatFilesBytesAsPerlAsciiCode.pl "3B\xA0Aramis Ramirez\xA0(R)\nC\xA0Jonathan Lucroy\xA0(R)\nCF\xA0Carlo +s Gomez\xA0(R)\n2B\xA0Rickie Weeks\xA0(R)\n1B\xA0Yuniesky Betancourt\ +xA0(R)\nP\xA0Yovani Gallardo\xA0(R)\nCF\xA0Robbie Grossman\xA0(S)\n2B +\xA0Jose Altuve\xA0(R)\nC\xA0Jason Castro\xA0(L)\nLF\xA0J.D. Martinez +\xA0(R)\n1B\xA0Chris Carter\xA0(R)\nDH\xA0Carlos Pena\xA0(L)\nRF\xA0J +immy Paredes\xA0(S)\n3B\xA0Matt Dominguez\xA0(R)\nSS\xA0Marwin Gonzal +ez\xA0(S)\nRF\xA0Eric Young Jr.\xA0(S)\nCF\xA0Dexter Fowler\xA0(S)\nL +F\xA0Carlos Gonzalez\xA0(L)\nSS\xA0Troy Tulowitzki\xA0(R)\nC\xA0Wilin + Rosario\xA0(R)\n1B\xA0Todd Helton\xA0(L)\n3B\xA0Nolan Arenado\xA0(R) +\n2B\xA0Josh Rutledge\xA0(R)\nP\xA0Jon Garland\xA0(R)\nSS\xA0Everth C +abrera\xA0(S)\nCF\xA0Will Venable\xA0(L)\n3B\xA0Chase Headley\xA0(S)\ +nLF\xA0Carlos Quentin\xA0(R)\n1B\xA0Yonder Alonso\xA0(L)\n2B\xA0Jedd +Gyorko\xA0(R)\nRF\xA0Chris Denorfia\xA0(R)\nC\xA0John Baker\xA0(L)\nP +\xA0Jason Marquis\xA0(L)\n"

    $ cat hitters | perl -ne 'print substr($_,index($_,"\xA0")+1,-5); print "\n";'
    Nolan Arenado
    Josh Rutledge
    Jon Garland
    Everth Cabrera
    Will Venable
    Chase Headley
    Carlos Quentin
    Yonder Alonso
    Jedd Gyorko
    Chris Denorfia
    John Baker
    Jason Marquis

    Now I can do something like:
    grep -f hitters bigger_file_to_search

    OQ91@BBCPC36662 /cygdrive/c/package
    $ grep -f dirty dirt | sort
    1B Adam LaRoche 2.1 40 WAS@SDP $2,700
    1B Billy Butler 2.7 39 KAN@OAK $3,600
    1B Brandon Belt 2.2 41 SFG@COL $3,100
    1B Brandon Moss 2.3 44 KAN@OAK $3,500
    1B Brett Pill 2 3 SFG@COL $2,600
    1B Chad Tracy 0.4 23 WAS@SDP $2,300
    1B Daric Barton 1.3 8 KAN@OAK $2,400
    1B Eric Hosmer 1.6 37 KAN@OAK $3,400
    1B Lance Berkman 2.8 37 DET@TEX $3,600
    1B Mark Kotsay 0.7 24 WAS@SDP $2,700
    1B Mitch Moreland 2.7 43 DET@TEX $3,300
    1B Nate Freiman 1.2 20 KAN@OAK $2,700
    1B Prince Fielder 3.4 41 DET@TEX $4,700


    THANK YOU VERY MUCH
      :) I learneded it from Tutorials Basic debugging checklist

      Here is another tip

      $ perl -F"\xA0" -lanse " print join q{ ### }, @F " hitters |tail P ### Jon Garland ### (R) SS ### Everth Cabrera ### (S) CF ### Will Venable ### (L) 3B ### Chase Headley ### (S) LF ### Carlos Quentin ### (R) 1B ### Yonder Alonso ### (L) 2B ### Jedd Gyorko ### (R) RF ### Chris Denorfia ### (R) C ### John Baker ### (L) P ### Jason Marquis ### (L)
        VERY NICE! thank you...

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1034431]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (13)
As of 2015-07-03 11:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (51 votes), past polls