Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: One-liner only checking the first line of the input file

by stevieb (Canon)
on Nov 11, 2015 at 14:23 UTC ( #1147452=note: print w/replies, xml ) Need Help??


in reply to One-liner only checking the first line of the input file

Are your line endings what you expect (ie. is the file being treated as one long line as opposed to several)? Try this, and see if you get a single line, or all of the lines printed:

perl -lane 'print $_; exit;' input.txt

Replies are listed 'Best First'.
Re^2: One-liner only checking the first line of the input file
by TJCooper (Beadle) on Nov 11, 2015 at 14:30 UTC
    perl -lane 'print $_; exit;' input.txt > output.txt

    Output.txt appears identical to the input file - all lines are printed.

      Do this:

      perl -anE '/(\R)/; say unpack("H*", $1);' input.txt

      It appears as your file is being read as one long string. If you're on *nix, your output should be 0a per line for as many lines you have in the file. Post what the output shows.

        Outputs 0d only once.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (2)
As of 2021-10-21 02:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My first memorable Perl project was:







    Results (82 votes). Check out past polls.

    Notices?