Remove double quotes from first line for all files

2019-08-14 03:46发布

问题:

I have 50 files in which column headers surrounded in double quotes on the first line. I want to remove the double quotes " from the first line for every file.

Can the changes be done in regular expression ??

Sample data.

"PRODUCTID","ATTRIBUTENAME_VALUE","STATE"
"00300678116042","NOT_APPLICABLE","CONFIRMED"
"00041260363603","NOT_APPLICABLE","CONFIRMED"

Expected output

PRODUCTID,ATTRIBUTENAME_VALUE,STATE
"00300678116042","NOT_APPLICABLE","CONFIRMED"
"00041260363603","NOT_APPLICABLE","CONFIRMED"

回答1:

If Notepad++ is Pcre compatible, you could

find: \G([^"\r\n]*)"
replace $1



回答2:

If the column header is as provided, the below find and replace should work. You could specify the actual header names inside the parentheses. I used the fact that the header didn't contain any digits to uniquely identify the header row.

Find all: \"(\D*)\",\"(.*)\",\"(.*)\"

Replace: \1,\2,\3