I have to remove quotes from a relatively large text file. I have looked at the questions that may have matched this one, yet I am still not able to remove the quotes from specific lines from the text file.
This is what a short segment from the file looks like:
1 - "C1".
E #1 - "C1".
2 - "C2".
1
2
E #2 - "C2".
I would like to have 1-"C1"
. be replaced by c1
, and E #1 - "C1"
be replaced with E c1
. I tried replacing these in python, but I get an error because of the double "'s
.
I tried:
input=open('file.text', 'r')
output=open(newfile.txt','w')
clean==input.read().replace("1 - "C1".","c1").replace("E #1 - "C1"."," E c1")
output.write(clean)
I have with sed:
sed 's\"//g'<'newfile.txt'>'outfile.txt'.
But yet another syntax error.