Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Faster and more efficient way to read a file vertically

by Laurent_R (Canon)
on Nov 03, 2017 at 18:27 UTC ( [id://1202718]=note: print w/replies, xml ) Need Help??


in reply to Faster and more efficient way to read a file vertically

This is a perl one-liner doing just what you want:
$ echo 'ACATCACCTCCCACAACGAGGACTACACCATCGTGGAACA > ACATCACCTCCCACAACGAGGACTACACCATCGTGGAACA > ACATCACCTCCCACAACGAGGACTACACCATCGTGGAACA > ACATCACCTCCCACAACGAGGACTACACCATCGTGGAACA > ACATCACCTCCCACAACGAGGACTACACCATCGTGGAACA > ACATCACCTCCCACAACGAGGACTACACCATCGTGGAACA > ACATCACCTCCCACAACGAGGACTACACCATCGTGGAACA > ACATCACCTCCCACAACGAGGACTACACCATCGTGGAACA > ACATCACCTCCCACAACGAGGACTACACCATCGTGGAACA > ACATCACCTCCCACAACGAGGACTACACCATCGTGGAACA > ACATCACCTCCCACAACGAGGACTACACCATCGTGGAACA > ACATCACCTCCCACAACGAGGACTACACCATCGTGGAACA > ACATCACCTCCCACAACGAGGACTACACCATCGTGGAACA' | perl -nE 'say substr($_, + 10, 1);' C C C C C C C C C C C C C
Check, though, that 10 is the right second parameter for substr, you may have to change it depending on which character you want exactly.

Replies are listed 'Best First'.
Re^2: Faster and more efficient way to read a file vertically
by dbuckhal (Chaplain) on Nov 03, 2017 at 22:50 UTC
    another one-liner:

    $ perl -F'' -anE 'say $F[9]'

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (6)
As of 2024-03-19 10:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found