我正在尝试用NA替换点(。)但我的当前代码正在替换。形成小数点,例如0.01。我正在使用
cat input.tsv | sed -r 's/\./NA/g' > replaced.tsv
我已经复制了其中一条输入线。
1 69091 A C M L . 1 69091 1 58954 OR4F5 + ATG 1 0 a ./. ./. ENSG00000186092 ENST00000335137 ENSP00000334393 1 0.13 0.26702 T Q8NH21 OR4F5_HUMAN 1 0.0 0.02634 B 0.0 0.01257 B 0.589091 0.05577 N 1.339740 . . . . . OR4F5_HUMAN M1L . . . 6.76 0.00529 T -0.38 0.13435 N NM_001005484.1 M1L 0.12 0.13350 -0.9577 0.39629 T 0.0009 0.00318 T 8 0.00708247797993 0.18931 T 0.109 0.31349 0.823 0.93536 Q8NH21 M1L Loss of sheet (P = 0.0817); Loss of disorder (P = 0.091); Loss of catalytic residue at V2 (P = 0.3992); Loss of solvent accessibility (P = 0.5485); Gain of helix (P = 0.5668) -1.436194 0.01840 0.003 0.44378301154325944 0.03370 0.02063 0.06083 N AEFI c -1.39413139690747 0.1192561 -1.53570515685522 0.09493324 0.02038 2.2163971633957E-5 0.03550 0.487112 0.13308 0 0.573888 0.26071 0 0.573888 0.22998 0 0.564101 0.26208 0 2.31 -4.63 0.03101 -0.055000 0.11668 -1.983000 0.00506 0.000000 0.06329 0.000000 0.01567 0.2547:0.0:0.5282:0.2171 3.5592 0.07372 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
期望的输出
1 69091 A C M L NA 1 69091 1 58954 OR4F5 + ATG 1 0 a ./. ./. ENSG00000186092 ENST00000335137 ENSP00000334393 1 0.13 0.26702 T Q8NH21 OR4F5_HUMAN 1 0.0 0.02634 B 0.0 0.01257 B 0.589091 0.05577 N 1.339740 NA NA NA NA NA OR4F5_HUMAN M1L NA NA NA 6.76 0.00529 T -0.38 0.13435 N NM_001005484.1 M1L 0.12 0.13350 -0.9577 0.39629 T 0.0009 0.00318 T 8 0.00708247797993 0.18931 T 0.109 0.31349 0.823 0.93536 Q8NH21 M1L Loss of sheet (P = 0.0817); Loss of disorder (P = 0.091); Loss of catalytic residue at V2 (P = 0.3992); Loss of solvent accessibility (P = 0.5485); Gain of helix (P = 0.5668) -1.436194 0.01840 0.003 0.44378301154325944 0.03370 0.02063 0.06083 N AEFI c -1.39413139690747 0.1192561 -1.53570515685522 0.09493324 0.02038 2.2163971633957E-5 0.03550 0.487112 0.13308 0 0.573888 0.26071 0 0.573888 0.22998 0 0.564101 0.26208 0 2.31 -4.63 0.03101 -0.055000 0.11668 -1.983000 0.00506 0.000000 0.06329 0.000000 0.01567 0.2547:0.0:0.5282:0.2171 3.5592 0.07372 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
答案 0 :(得分:3)
这样的事情?
sed -E 's/(^| )\.( |$)/ NA/g' file
查找包含周围空格的点,同时检查行开始或行结束。你需要吃掉其中一个空间。我选择了正确的。