Network Automation Software We are currently migrating this forum
over to our HelpSystems domain. Please
post all new threads in our new
HelpSystems Community Portal.
Post to the HelpSystems Forum
You are not currently logged on. You must be logged on in order to post. Log on
Or Create a new account
AutoMate Discussion
Decrease font size
Increase font size
Topic Title: Remove commas within double quotes
Topic Summary:
Created On: 04/11/2013 08:51 PM
Status: Read Only
Linear : Threading : Single : Branch
Search Topic Search Topic
Topic Tools Topic Tools
View similar topics View similar topics
View topic in raw text format. Print this topic.
 04/11/2013 08:51 PM
User is offline View Users Profile Print this message

Author Icon
RichardNg
n00b (>6 posts)

Posts: 4
Joined: 04/11/2013

I have a csv file which contains a field that is partialy enclosed in double quotes.   Sometimes there is a comma within the quotes and I want to replace that with a space.

 

Here is an example of the data:

abc,"SMITH,JOHN" <sip:5555551234@214.244.84.5;isup-oli=0;user=phone>;tag=SDe1ga601,def

I'd like the result to be:

abc,"SMITH JOHN" <sip:5555551234@214.244.84.5;isup-oli=0;user=phone>;tag=SDe1ga601,def

 

Can I use automate for this?



 Category Survey
 04/12/2013 08:43 AM
User is offline View Users Profile Print this message

Author Icon
Liz Casale
AUTOMATE EMPLOYEE

Posts: 940
Joined: 05/23/2011

Hi Richard,

The follow steps will check for the comma within the quotes.

 Category Survey



Task Steps: (Right click, Select All, Copy to copy to the clipboard. Steps can then be pasted into the AutoMate Task Builder)


-------------------------
Liz Casale
Technical Support Representative
(213) 738-6966
Network Automation, Inc.

--------------------------------------------------------------------------------

AM5 5.5.5.1; AM6 6.2.8.0; AM7 7.1.3.0; AM8 8.0.9.0; AM9 9.0.3.4
BPA7 7.1.3.0; BPA8 8.0.9.0; BPA9 9.0.3.4

Edited: 04/12/2013 at 08:52 AM by Liz Casale
 04/12/2013 11:35 AM
User is offline View Users Profile Print this message

Author Icon
JeanDelfosse
Supreme Guru (1000+)

Posts: 8883
Joined: 03/30/2005

see following mesage

 Category Survey
AutoMate 6 version:
Windows version:


-------------------------
Jean Delfosse - Automate Beta Tester
Win7 Pro 64 bits -Win XP Pro SP3 32 bits - AM8, AM7, BPA10, BPA9, BPA8, BPA7, AM6 Enterprise, AM4
 04/12/2013 11:37 AM
User is offline View Users Profile Print this message

Author Icon
JeanDelfosse
Supreme Guru (1000+)

Posts: 8883
Joined: 03/30/2005

Richard,
below a solution with a single regular expression

 Category Survey
AutoMate 6 version:
Windows version:



Task Steps: (Right click, Select All, Copy to copy to the clipboard. Steps can then be pasted into the AutoMate Task Builder)


-------------------------
Jean Delfosse - Automate Beta Tester
Win7 Pro 64 bits -Win XP Pro SP3 32 bits - AM8, AM7, BPA10, BPA9, BPA8, BPA7, AM6 Enterprise, AM4
 04/12/2013 11:40 AM
User is offline View Users Profile Print this message

Author Icon
RichardNg
n00b (>6 posts)

Posts: 4
Joined: 04/11/2013

I cant seem to get this to work.  Perhaps I didnt explain the file I'm working with properly.  I have attached a few lines from the actual file I am trying to parse.

There are hundreds of lines in this file..this is just an example.

Double quote qualifers only occur once per line.

Do I have to load the whole file into var1?



 Category Survey


myfile.csv
myfile.csv  (2 KB)

 04/12/2013 01:34 PM
User is offline View Users Profile Print this message

Author Icon
RichardNg
n00b (>6 posts)

Posts: 4
Joined: 04/11/2013

Thanks for the help.

I'm afraid I just dont know how to apply this to my situation.

How would you translate this to read each line of my csv file? (see myfile.csv)

I'm looking for automate to read my file, find the text in between the double quotes and replace any commas with spaces if they exist. - they might not.

I tried populating the orig variable with my entire csv, then rewriting a new file at the end, but the commas are still there.

 

Sorry for my ignorance if this is something simple.

 

 



 Category Survey
 04/12/2013 09:37 PM
User is offline View Users Profile Print this message

Author Icon
JeanDelfosse
Supreme Guru (1000+)

Posts: 8883
Joined: 03/30/2005

Richard,
I 'm sorry I did not realize you work on AM6 where regular expressions capabilities are very limited

The steps below are really AM6 and work with your csv.
You will have to read the whole file in variable "orig" (I did my sample with only one excerpt of it)
and at the end, the orig variable is fixed, with no more commas inside the quotes


 Category Survey
AutoMate 6 version:
Windows version:



Task Steps: (Right click, Select All, Copy to copy to the clipboard. Steps can then be pasted into the AutoMate Task Builder)


-------------------------
Jean Delfosse - Automate Beta Tester
Win7 Pro 64 bits -Win XP Pro SP3 32 bits - AM8, AM7, BPA10, BPA9, BPA8, BPA7, AM6 Enterprise, AM4
 04/13/2013 05:55 PM
User is offline View Users Profile Print this message

Author Icon
RichardNg
n00b (>6 posts)

Posts: 4
Joined: 04/11/2013

Yes!

Thanks very much Jean, and sorry you had to completely spell it out for me

This solution worked.

 

 

keep smiling  



 Category Survey
 04/13/2013 10:38 PM
User is offline View Users Profile Print this message

Author Icon
JeanDelfosse
Supreme Guru (1000+)

Posts: 8883
Joined: 03/30/2005

You're welcome, Richard.

 Category Survey
AutoMate 6 version:
Windows version:


-------------------------
Jean Delfosse - Automate Beta Tester
Win7 Pro 64 bits -Win XP Pro SP3 32 bits - AM8, AM7, BPA10, BPA9, BPA8, BPA7, AM6 Enterprise, AM4
Statistics
18258 users are registered to the AutoMate Discussion forum.
There are currently 0 users logged in.
The most users ever online was 5551 on 01/08/2018 at 11:11 AM.
There are currently 1721 guests browsing this forum, which makes a total of 1721 users using this forum.

FuseTalk Enterprise Edition v4.0 - © 1999-2020 FuseTalk Inc. All rights reserved.

Sitemap Network Automation Software Blog