last day (15 days later) » 

9:35 AM
0
Q: Performance issue in Perl command

SatyaI've used the following command to remove special characters in number columns (.CSV file) and it is working fine as excepted but the issue here is performance. My CSV file number column data contains as below. To remove 1000 separator comma in data I've used the following Perl command. payment ...

 
Could you please provide us with 1) a sample of your file that matches your code (in particular, there are no double quotes " in the file, but there are some in your code). 2) the actual code you are using (echo cat | perl makes no sense).
Also, why did you use the python tag? I see no mention to Python in your question...
 
Yes, there is a double quote in the values. My file data exactly like below. "4326,34" . Wherever we have 1000 separator then we have double quotes in that value. below 1000 values don't have double quotes.
Ignore the echo part, I just used a shell script to get output.
Corrected my post with exact file data and removed the echo part.
 
Any reason preventing you to just remove doubles quotes and commas with s/[",]//g or y/",//d?
 
My file delimiter was "," comma and the payment column is a number data type. I just want to remove the 1000 separator wherever we have a comma in double-quotes for all the numeric values. Note we have around 10 number columns in the entire file. this code takes care of all the values. The only issue with performance.
Hello
Dada, Thanks for your support. Did you get what I am looking?
 
9:45 AM
Please, give some lines of your input file and expected result.
 
Added input file data and excepted output file data too for your reference in post.
 
Give it in text format, not image.
 
10:04 AM
added text format in post.
 
 
2 hours later…
12:05 PM
Is remove quote mandatory? It will be faster to remove comma only. Smething like: perl -pe 's/(?<=\d),(?=\d)//g' file`
 
 
4 hours later…
3:42 PM
if we not remove quotes then column type act as string right instead of number ?
Perl -pe 's/(?<=\d),(?=\d)//g' file` --? this is not working. It was removed comma in double quote value along without double-quote values too
 

last day (15 days later) »