免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12下一页
最近访问板块 发新帖
查看: 4515 | 回复: 12

awk处理 [复制链接]

论坛徽章:
0
发表于 2011-06-29 16:31 |显示全部楼层
'ENSP00000240361':  
  TEX14 - testis expressed 14; Required for spermatogenesis and male fertility. May be required for normal structure of the intercellular bridge that connects spermatocytes and spermatogonia. Has no protein kinase activity (in vitro) (By similarity)
ENSP00000240619':  
  TAS2R10 - taste receptor, type 2, member 10; Gustducin-coupled strychnine receptor implicated in the perception of bitter compounds in the oral cavity and the gastrointestinal tract. Signals through PLCB2 and the calcium- regulated cation channel TRPM5  
'ENSP00000242576':  
  UNG - uracil-DNA glycosylase; Excises uracil residues from the DNA which can arise as a result of misincorporation of dUMP residues by DNA polymerase or due to deamination of cytosine (By similarity)  
'ENSP00000243457':  
  KCNJ2 - potassium inwardly-rectifying channel, subfamily J, member 2; Probably participates in establishing action potential waveform and excitability of neuronal and muscle tissues. Inward rectifier potassium channels are characterized by a greater tendency to allow potassium to flow into the cell rather than out of it. Their voltage dependence is regulated by the concentration of extracellular potassium; as external potassium is raised, the voltage range of the channel opening shifts to more positive voltages. The inward rectification is mainly due to the blockage of outward current by inter [...]   

我要吧'ENSP00000240361':   TEX14   - testis expressed 14; Required for spermatogenesis and male fertility. May be required for normal structure of the intercellular bridge that connects spermatocytes and spermatogonia. Has no protein kinase activity (in vitro) (By similarity)
分成3列 然后要用ENSP00000240361 去匹配另外一个文件里边的一个号.

多谢了

论坛徽章:
1
2015年辞旧岁徽章
日期:2015-03-03 16:54:15
发表于 2011-06-29 16:38 |显示全部楼层
他们都表示没有看懂你的意思?咋办?

论坛徽章:
0
发表于 2011-06-29 16:42 |显示全部楼层
比如
'123456':
AVD - dfdsa dsfsdf fklsdfjsa;fsafsfsf
'234456':
CDR- dfasfsadfsad dsaffsdfsadfsf

我要的结果
123456   AVD    dfdsa dsfsdf fklsdfjsa;fsafsfsf
234456   CDR    dfasfsadfsad dsaffsdfsadfsf

论坛徽章:
0
发表于 2011-06-29 16:45 |显示全部楼层
不好意思 没写清楚

论坛徽章:
0
发表于 2011-06-29 17:04 |显示全部楼层
本帖最后由 ywlscpl 于 2011-06-29 17:15 编辑

回复 3# liaoboda

没看清,原来还要删'号
  1. awk -F "'" '$0~"^"FS{printf $2;next}{sub(/-/,"")}1' file
复制代码

论坛徽章:
1
摩羯座
日期:2014-12-29 15:59:36
发表于 2011-06-29 17:08 |显示全部楼层
  1. awk -F"'" '/^\x27/{printf $2;FS=" - "}/^[^\x27]/{print  "\t"$1"\t"$2;FS="\x27"}'  file
复制代码

论坛徽章:
0
发表于 2011-06-29 17:38 |显示全部楼层
回复  liaoboda

没看清,原来还要删'号
ywlscpl 发表于 2011-06-29 17:04



多谢了! 但是这个还是有一点问题的 第一行是搞不出来的

论坛徽章:
0
发表于 2011-06-29 17:41 |显示全部楼层
ziyunfei 发表于 2011-06-29 17:08



    多谢了!这个第一行也有问题,不过把引号和冒号去了.但是$2 和$3的间距不够,我下边的awk不好区别了

论坛徽章:
0
发表于 2011-06-29 17:58 |显示全部楼层
回复 8# liaoboda


    ywlscpl@ubuntu:~$ cat file
'123456':
AVD - dfdsa dsfsdf fklsdfjsa;fsafsfsf
'234456':
CDR- dfasfsadfsad dsaffsdfsadfsf
ywlscpl@ubuntu:~$ awk -F "'" '$0~"^"FS{printf $2" ";next}{sub(/-/,"")}1' file
123456 AVD  dfdsa dsfsdf fklsdfjsa;fsafsfsf
234456 CDR dfasfsadfsad dsaffsdfsadfsf

论坛徽章:
1
2015年辞旧岁徽章
日期:2015-03-03 16:54:15
发表于 2011-06-29 18:01 |显示全部楼层
回复 9# ywlscpl


    这个只是楼主举的例子,实际上他还是想处理顶楼的那些数据
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP