文本文件中的引号

时间:2013-10-17 11:42:23

标签: bash unix sed

我不熟悉使用UnixR等。我正在使用NCBI数据集分析GEO 2r网站上的一些数据。我从网站上下载了一些数据并将其放在文本文件中。但是,数据始终有引号,我试图摆脱这些,但一直无法这样做。该文件名为GSE23182_geo2r.txt,并使用了以下功能:

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

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

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

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

但它们都没有奏效,似乎也出现了问题:no such file or directory

对任何帮助都会非常感激!!

谢谢

2 个答案:

答案 0 :(得分:1)

文件'test'包含大量“ 该文件的内容是:

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

现在删除“我们使用tr -d命令。

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

现在,您可以将其重定向到另一个文件,如下所示:

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

答案 1 :(得分:0)

一种简单的方法是在vim中打开文件并发出命令: :%S / \“//克

这将删除“整个文件。

相关问题