本文介绍了发现之前与QUOT替换字符;:"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我具有包含一定数目的行的文件。每一行看起来是这样的:
I have a file containing a certain number of lines. Each line looks like this:
TF_list_to_test10004/Nus_k0.345_t0.1_e0.1.adj:PKMYT1
我想所有之前删除:为了留住这是唯一一个基因名PKMYT1字符。
因为我不是在正则表达式脚本专家谁能帮助我做到这一点使用的Unix(SED或AWK)或R'
I would like to remove all before ":" character in order to retain only PKMYT1 that is a gene name.Since I'm not an expert in regex scripting can anyone help me to do this using Unix (sed or awk) or in R?
推荐答案
下面是R中做的两种方式:
Here are two ways of doing it in R:
foo <- "TF_list_to_test10004/Nus_k0.345_t0.1_e0.1.adj:PKMYT1"
# Remove all before and up to ":":
gsub(".*:","",foo)
# Extract everything behind ":":
regmatches(foo,gregexpr("(?<=:).*",foo,perl=TRUE))
这篇关于发现之前与QUOT替换字符;:&QUOT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!