This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to delete part of row names in a list in linux

I have a list of names. I want to delete part of the names and keep only the last part. Can someone help me with a script in Linux or in R?

List I have

sp|Q9LQM8|M2K10_ARATH
sp|Q1PE17|CDPKI_ARATH
sp|Q0D715|CDPKI_ORYSJ
sp|Q9SND6|M3K20_ARATH

I want to have

M2K10_ARATH
CDPKI_ARATH
CDPKI_ORYSJ
M3K20_ARATH
linux

What have you tried? This is basic string manipulation and is almost off topic on the site.

1 answer

try cat your.file | cut -d"|" -f3

Log in to answer this question.