During my workflow I have created this file:
AAGGAGGGAGCTGCATGGAACCTGTGGATATATACACACAAGGTTAACCTCTGTCCTGTAAA 8
GGAGTTCAGATGTGTGCTCTTCCGATCTGGAGGTCTCTGCTGGGGCCACCCTGTCCTCTCAG 30
GAGAGAGGAAAGGAAGCGATTGCAGAACTTTCCACAAGGCTTTAGATTCCCCTGTCACAGAG 15
GGAGGAGAAAGAATCAACTTTATAGCATCAGCCCCTTGTTTATTTTAAGTTCAGGGTTTAAG 13
GGGAGAACATTTCCCTCCTTGTCCTCTCCTATCTCACTTACTACATTCCCACTGGTCACTGT 7
GGGACATTTGTGATTACATGGTTGCAGTATTCTTTTTGTTCTTAGTCAGACTGTATAATTGG 4
I would like to select from each text of the first column the first number of letters as present in the amount of the second column. Like first 8 character of the first row, first 30 character of the second row etc..
Like the first as example the output would be something like this:
AAGGAGGG
GGAGTTCAGATGTGTGCTCTTCCGATCTGG
Any idea would be really appreciated.
awk '{ print substr($1, 0, $2) }'. No side effect on$0or cryptic1pattern with implicitprintaction. – Kaz Sep 01 '16 at 02:49awk '$0 = substr($1, 0, $2)'. – Kaz Sep 01 '16 at 02:531: you must be new here... – Satō Katsura Sep 01 '16 at 05:08