I have a text file that is a mess.  It contains various fields with lots
of spaces between the fields.  The amount of spaces differs from field to
field.  Here is a sample of the file:

<8sp>NAME:<13sp>JOHN
SMITH<22sp>RANK:<3sp>CAPTAIN<15sp>WIFE:<6sp>POCAHONTAS...

What I would like to have after processing the file is a tab delimited
file like:

<tab>NAME:<tab>JOHN SMITH<tab>RANK:<tab>CAPTAIN<tab>WIFE:<tab>POCAHONTAS...

I have been experimenting with the s/// and had some success.  The only
problem is that I have about 30 of the s/// statements to try and deal
with all of the <sp> in the file.  I know this is not efficient.

What I want to do is replace any repeating spaces (two or more) with a
tab.  I know the examples below do not work but am just giving it as
"pseudocode" of replacing repeating spaces (between 2 and 50) with a tab:

s/<sp>[2..50]/\t/gi;

or maybe hex value (hex 20 is the space character)

s/\x20[2..50]/\t/gi;

Thanks.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to