Hi,
I am working on a command that replaces some occurrences of quotation marks in file. The quotation mark cannot be the first or the last character in line and cannot be preceded or followed by a comma.
I am not an expert in regular expressions, but I managed to create the following command.
sed 's/\([^,]\)\"\([^,]\)/\1\"\"\2/g' file.txt
Can you please verify it or tell me how to do it better? Any help will be appreciated.
Regards,
Pit
Hi,
Small update regarding my problem. Currently I need to match pattern from the last occurence of
","
or
,,"
till the end of line. For example matching on the following line:
"one","two","three",,"five",,"sev"e,n"
should return
sev"e,n
. I would like to use sed or awk, but any other solution will be fine. Can you please help me writing a proper regular expression?
Pit
you could do within vi the global repleace
:g/c2/s//c5/g
this replaces everything with c2 to c5. you could some how work this into a script to do a larger directory if you do not feel like vi a file. not sure though