Hi all! I have a strange search/replace situation & sometimes looking at GREP makes me cross-eyed!

2019-06-03 Thread Aethon
I have a big file that I had exported from the office as a CSV (forgetting 
that I had done the first part a while back as tab-separated).

So now I have a list where some of the text columns contains commas and 
this throws the whole structure/order off.

Here is a sample of the data.


home,ATC-Sea-Serpents-by-Gustav-Klimt,ArtToCanvas,*54W x 27H inches : Sea 
Serpents by Gustav Klimt*,ArtToCanvas,prints,319,,,1,https://arttocanvas.com
home,ATC-Gold-Swirls-by-Lisa-Kowalski,ArtToCanvas,*30W x 40H inches : Gold 
Swirls by Lisa Kowalski*,ArtToCanvas,prints,269,,,1,https://arttocanvas.com
home,ATC-Blue-Green-and-Brown-by-Mark-Rothko,ArtToCanvas,*26W x 32H inches 
: Blue, Green, and Brown by Mark Rothko*
,ArtToCanvas,prints,219,,,1,https://arttocanvas.com
home,ATC-La-seperazione-dell-atomo-by-Salvador-Dali,ArtToCanvas,*50W x 26H 
inches : La seperazione dellatomo by Salvador Dali*
,ArtToCanvas,prints,299,,,1,https://arttocanvas.com

Now, what I want is to replace the commas from the centre column (in bold).

I had use a grep search like the following :

ArtToCanvas,(.+),ArtToCanvas,prints 


to select the correct information—but I don't know to do a further 
replacement of the commas when I output the \1.


Is this even possible using  Bbedit Grep?

I have version 10.5.3

Thanks,
George

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or need technical support, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/e548236e-c87a-4c5c-9544-7c46b8588ada%40googlegroups.com.


Re: Hi all! I have a strange search/replace situation & sometimes looking at GREP makes me cross-eyed!

2019-06-03 Thread ThePorgie
In your sample data would the patten be inconsistent regarding the number 
of commas that need to be replaced? I'm thinking that might be the case 
looking at your sample...Also if you want to replace the commas in the 
bolded copy what is it you want to replace them with?

Not knowing the number of commas I might choose to use Quotes to ID the 
copy with a grep string like

find:
(?<=ArtToCanvas,)(.+)(?=,ArtToCanvas,prints,)
replace:
"\1"

Parts explained **Look ahead and look behind are not found and therefor are 
not captured.
(?<=ArtToCanvas,) Positive look behind
(.+) Captured copy
(?=,ArtToCanvas,prints,) Positive look ahead

This will put Quotes around your copy at which point you would be able to 
replace just the commas between the quotes or import into Excel or most 
other apps as the structure should be correct for dealing with the commas 
in the string.


Hope that helps
-George

On Monday, June 3, 2019 at 9:34:03 AM UTC-4, Aethon wrote:
>
> I have a big file that I had exported from the office as a CSV (forgetting 
> that I had done the first part a while back as tab-separated).
>
> So now I have a list where some of the text columns contains commas and 
> this throws the whole structure/order off.
>
> Here is a sample of the data.
>
>
> home,ATC-Sea-Serpents-by-Gustav-Klimt,ArtToCanvas,*54W x 27H inches : Sea 
> Serpents by Gustav Klimt*,ArtToCanvas,prints,319,,,1,
> https://arttocanvas.com
> home,ATC-Gold-Swirls-by-Lisa-Kowalski,ArtToCanvas,*30W x 40H inches : 
> Gold Swirls by Lisa Kowalski*,ArtToCanvas,prints,269,,,1,
> https://arttocanvas.com
> home,ATC-Blue-Green-and-Brown-by-Mark-Rothko,ArtToCanvas,*26W x 32H 
> inches : Blue, Green, and Brown by Mark Rothko*
> ,ArtToCanvas,prints,219,,,1,https://arttocanvas.com
> home,ATC-La-seperazione-dell-atomo-by-Salvador-Dali,ArtToCanvas,*50W x 
> 26H inches : La seperazione dellatomo by Salvador Dali*
> ,ArtToCanvas,prints,299,,,1,https://arttocanvas.com
>
> Now, what I want is to replace the commas from the centre column (in bold).
>
> I had use a grep search like the following :
>
> ArtToCanvas,(.+),ArtToCanvas,prints 
>
>
> to select the correct information—but I don't know to do a further 
> replacement of the commas when I output the \1.
>
>
> Is this even possible using  Bbedit Grep?
>
> I have version 10.5.3
>
> Thanks,
> George
>

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or need technical support, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/d889a4a4-3de0-467c-af9b-90658d885aea%40googlegroups.com.


Re: Hi all! I have a strange search/replace situation & sometimes looking at GREP makes me cross-eyed!

2019-06-03 Thread Aethon
That is simple and clever.  Thanks man!

-George

On Monday, June 3, 2019 at 10:30:33 AM UTC-4, ThePorgie wrote:
>
> In your sample data would the patten be inconsistent regarding the number 
> of commas that need to be replaced? I'm thinking that might be the case 
> looking at your sample...Also if you want to replace the commas in the 
> bolded copy what is it you want to replace them with?
>
> Not knowing the number of commas I might choose to use Quotes to ID the 
> copy with a grep string like
>
> find:
> (?<=ArtToCanvas,)(.+)(?=,ArtToCanvas,prints,)
> replace:
> "\1"
>
> Parts explained **Look ahead and look behind are not found and therefor 
> are not captured.
> (?<=ArtToCanvas,) Positive look behind
> (.+) Captured copy
> (?=,ArtToCanvas,prints,) Positive look ahead
>
> This will put Quotes around your copy at which point you would be able to 
> replace just the commas between the quotes or import into Excel or most 
> other apps as the structure should be correct for dealing with the commas 
> in the string.
>
>
> Hope that helps
> -George
>
> On Monday, June 3, 2019 at 9:34:03 AM UTC-4, Aethon wrote:
>>
>> I have a big file that I had exported from the office as a CSV 
>> (forgetting that I had done the first part a while back as tab-separated).
>>
>> So now I have a list where some of the text columns contains commas and 
>> this throws the whole structure/order off.
>>
>> Here is a sample of the data.
>>
>>
>> home,ATC-Sea-Serpents-by-Gustav-Klimt,ArtToCanvas,*54W x 27H inches : 
>> Sea Serpents by Gustav Klimt*,ArtToCanvas,prints,319,,,1,
>> https://arttocanvas.com
>> home,ATC-Gold-Swirls-by-Lisa-Kowalski,ArtToCanvas,*30W x 40H inches : 
>> Gold Swirls by Lisa Kowalski*,ArtToCanvas,prints,269,,,1,
>> https://arttocanvas.com
>> home,ATC-Blue-Green-and-Brown-by-Mark-Rothko,ArtToCanvas,*26W x 32H 
>> inches : Blue, Green, and Brown by Mark Rothko*
>> ,ArtToCanvas,prints,219,,,1,https://arttocanvas.com
>> home,ATC-La-seperazione-dell-atomo-by-Salvador-Dali,ArtToCanvas,*50W x 
>> 26H inches : La seperazione dellatomo by Salvador Dali*
>> ,ArtToCanvas,prints,299,,,1,https://arttocanvas.com
>>
>> Now, what I want is to replace the commas from the centre column (in 
>> bold).
>>
>> I had use a grep search like the following :
>>
>> ArtToCanvas,(.+),ArtToCanvas,prints 
>>
>>
>> to select the correct information—but I don't know to do a further 
>> replacement of the commas when I output the \1.
>>
>>
>> Is this even possible using  Bbedit Grep?
>>
>> I have version 10.5.3
>>
>> Thanks,
>> George
>>
>

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or need technical support, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/5d5b1eab-e130-4c0b-8ca2-5b99d9c9286b%40googlegroups.com.