Is there an edit that can do this?

Boaz Bezborodko boaz at mirrotek.com
Sat Aug 22 20:18:18 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
>
Thanks, Ken.

BTW, I'm pretty sure that the original intent was probably a tab as a 
delimiter within that field.  But the file is sent to me in XLS format 
and the spaces are already in that cell in that format.  I simply save 
the data as a CSV in order to work on it.

Boaz


More information about the Filepro-list mailing list