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 | [reply] [d/l] [select] |
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
| [reply] [d/l] |
$ 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)
| [reply] [d/l] |
you changed your code in the meantime from
perl -e 'print substr($_,index($_,chr(219)));'
to a while loop...
Try to use the options "-ne" to loop over the file
perl -ne 'print substr($_,index($_,chr(219)));'
see perlrun
IMHO it still doesn't do anything useful.
I doubt you will ever explain what it was supposed to do.
Cheers Rolf
( addicted to the Perl Programming Language)
| [reply] [d/l] [select] |
I just want to return the position where it finds the character, whatever it's called... then I can print the text between the two instances of the character...
| [reply] |
> then I can print the text between the two instances of the character...
many of your example lines have only one instance of that character.
Otherwise you could just use something like print ((split /\xA0/,$_)[1])
Cheers Rolf
( addicted to the Perl Programming Language)
update
corrected escape code
| [reply] [d/l] |