changing the position of a column from a file to another in perl
0
0
Entering edit mode
6.5 years ago

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 • 1.1k views
ADD COMMENT
3
Entering edit mode

This looks like a pure programming question which would be more appropriate on Stackoverflow

ADD REPLY
2
Entering edit mode

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.

ADD REPLY
1
Entering edit mode

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.

ADD REPLY
0
Entering edit mode

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.

ADD REPLY

Login before adding your answer.

Traffic: 1664 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6