Is there an edit that can do this?

Brian K. White brian at aljex.com
Fri Aug 21 20:52:05 PDT 2009



Kenneth Brody wrote:
> Boaz Bezborodko wrote:
>   
>> Part of me offers this up just to see how quickly Ken can come up with 
>> something.  (I know that I just don't do recursive thinking as easily.)
>>
>> I am setting up a program to process a CSV file.  One of the data lines 
>> is an address field that has the entire address in one field with the 
>> data elements each separated by a string of 8 spaces.  I was wondering 
>> if it is easy to create an edit that replaces each set of 8 spaces with 
>> some other character for which it would be easier to search.  One little 
>> difficulty is that there can be a string of 16 spaces when no 2nd 
>> address line exists, which is most of the time.
>>     
> [...]
>
> Is it literally "replace any sequence of 8 spaces with (some character)"? 
> That took me about a minute, including fixing it to not treat trailing 
> spaces as something to convert.
>
>      { ( {!" "!}@ ) | ( !"        "!<"~"> ) | * }
>
> This will convert any sequence of 8 spaces to a tilde.  Change the choice of 
> character as you see fit.
>
> Your example:
>
> Joe Shmoe        1136 Feather Grass Ln                Raleigh,
> NC-27613
>
> is converted to:
>
> Joe Shmoe~1136 Feather Grass Ln~~Raleigh,~NC-27613
>
>   

It's really 8 spaces? Not a single tab, which is both a common delimiter
and which most editors and viewers will display as 8 spaces?
Sure the data wasn't viewed and re-saved somewhere along the way
possibly changing tabs to spaces?

-- 
bkw



More information about the Filepro-list mailing list