This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Column Regex Find And Replace

Hi

I have a very basic query. I am having my blast results in tabular format. Column 2 in my results look like

gi|6561412|gb|AF191073.1|AF191073_Stealth_virus_1_clone_3B43,_genomic_sequence

I want to get output like as mentioned below

6561412

I want to do this using Column Regex Find And Replace

Regards Ali Zohaib

regex text manipulation

2 answers

So you want to extract the gi number? I think those have deprecated. Anyway the regex in perl would be something like /gi|(\d+)|/ I don't know what Column Regex Find And Replace means, it is not a software, I guess.

Thanks Sir for your valuable comments Solved

Column Regex Find And Replace is a tool available on our serve in which we just selected the column to work on in our dataset.

csvtk, supporting Windows/Linux/Mac OS X

csvtk replace -H -t -f 2 -p "gi\|(\d+).+" -r "\$1" data.tsv

Log in to answer this question.