user2882469
user2882469

Reputation: 11

Quotation marks in text file

I am new to using Unix and R etc. I am in the process of analysing some data from the NCBI website using GEO 2r datasets. I have downloaded some data from the website and have it in a text file. However, the data has quotation marks throughout and I am trying to get rid of these but have been unable to do so. The file is called GSE23182_geo2r.txt and have used following functions:

sed 's/\"//g' GSE23182_geo2r.txt  > GSE23182_geo2r_2.txt

and

sed 's/\"//g' GSE23182_geo2r.txt

and

sed "s/\"//g" GSE23182_geo2r.txt

and

cat GSE23182_geo2r.txt | tr -d '\"' > GSE23182_geo2r_2.txt 

but none of them have worked and seem to present with the problem: no such file or directory

Would be so grateful for any help!!

Thanks

Upvotes: 0

Views: 322

Answers (2)

plasmixs
plasmixs

Reputation: 156

File 'test' contains lots of " The contents of the file are:

$ cat test 
hi " this is a a quote"
"'"starting quote""

Now to delete " we use tr -d command.

$ cat test |tr -d "\""
hi  this is a a quote
'starting quote

Now you can re-direct this to another file as under:

$ cat test |tr -d "\"" >test1
$ cat test1 
hi  this is a a quote
'starting quote

Upvotes: 1

plasmixs
plasmixs

Reputation: 156

One simple way would be to open the file in vim and issue the command: :%s/\"//g

This would remove " throughout the file.

Upvotes: 0

Related Questions