This is a test version of Biostars. For the public version, visit https://www.biostars.org.
changing the position of a column from a file to another in perl

I have a .dta file which contains below output

1600000000000   00000000000   060218                                    BOSTON       MA 15000060000000000000000F5466160239558164
1600000000000   00000000000   060718                                    BOSTON       MA 15000070000000000000000N379809904781009
1600000000000   00000000000   060818                                    BOSTON       MA 15000080000000000000000N372512000987069
1600000000000   00000000000   060918                                    BOSTON       MA 15000090000000000000000F5466307589134928

The field "BOSTON" starting position is 74 and ending position is 80, it's length is 6. I want to write the column which is having "BOSTON" from the .dta file to another file (.trns file), but the position will be different. For eg : The second file in which i want to write should have the column which is having "BOSTON" from starting postion 10 and ending position 16. Since i am new to perl. Can anybody help me out with that?

assembly

well, instead of character positions, think as columns. For eg in OP file, it is 4th column (BOSTON). Read first file. Keep 4th column in array. Then read final file and print in a position wherever you want.

Since i am new to perl. Can anybody help me out with that?

If you post what you've tried, someone knowledgeable in Perl (if you need to use Perl) can help you figure out what might be wrong with your code.

Can you please post the sample / expected output (in the form of a table)? Maybe using the data that you have mentioned in this question.

0 answers

No answers yet.

Log in to answer this question.