I have a data file with thousands of records. The problem is that the records in the data file span two lines for each record. I want to write a perl script that makes each record a single line. The file looks like this:
RECORD1FIELD1 RECORD1FIELD2 RECORD1FIELD3 RECORD1FIELD3 RECORD1FIELD4 RECORD1FIELD5 RECORD2FIELD1 RECORD2FIELD2 RECORD2FIELD3 RECORD2FIELD3 RECORD2FIELD4 RECORD2FIELD5 . . . What I want is this: RECORD1FIELD1 . . .RECORD1FIELD5 RECORD2FIELD1 . . .RECORD2FIELD5 The second line of each record actually has a bunch of spaces before the first field. I thought I could exploit this with: s/\n //gi; what I thought would happen is the script would look for a new line followed by a bunch of empty spaces and delete only those. But that didn't work. Using a hex editor I saw that each new line was 0D 0A. I then tried: s/\x0D\x0A//gi; that didn't work either. I just want to move the second line of each record to the end of the first. It seems so simple, but I am exhausted of trying different things. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/