[Cialug] text munging
carl-olsen at mchsi.com
carl-olsen at mchsi.com
Thu Oct 26 07:25:26 CDT 2006
It looks like the last field is just a string with spaces at every 7th character. It should be easy to split such a string into an array. Will that fix it?
If you actually have empty fields, then you could do the reverse with the non-empty fields and combine them into an array.
I don't know what programming languages you use, but this should be easy in PHP, Java, C#, or JavaScript. I haven't used PERL for so long, I can remember anything about it, but I suspect it is just as easy to do in PERL or any other programming language.
Carl Olsen
http://www.carl-olsen.com/
-------------- Original message from Dave Weis <djweis at internetsolver.com>: --------------
>
> I have a small file processing problem. I have a file consisting of rows
> like this:
> DESMIAAW RT 6650 ASHWORTH RD WDMNIAAQ 410701 410702
> 410704 410801
> 410803 411101
>
> DESMIAAW DSLAM 7410 ASPEN DR WDMNIAIA ADSL 410801
> The first row has a variable number of 6 digit numbers at the end, the
> row after doesn't have that. I need to end up with the row "normalized"
> so if it gets in a row with 6 numbers at the end, I want six rows out
> with each number in the sequence at the end. There can be up to 9 of the
> numbers at the end.
>
> I can do something similar in perl or awk but never bothered to learn
> how to do the variable number of repeating numbers bit.
> _______________________________________________
> Cialug mailing list
> Cialug at cialug.org
> http://cialug.org/mailman/listinfo/cialug
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://cialug.org/pipermail/cialug/attachments/20061026/a14f4e55/attachment.htm
More information about the Cialug
mailing list