Entering edit mode
2.3 years ago
blackadder
▴
30
Hello there,
I have a file with ftp links that look like this:
> ftp.sra.ebi.ac.uk/vol1/sequence/ERZ914/ERZ914930/contig.fa.gz
> ftp.sra.ebi.ac.uk/vol1/sequence/ERZ928/ERZ928990/contig.fa.gz
> ....
I am reading them one by one with a while loop in bash and what I'm trying to do is to drop everything before and after ERZ914930
. So, I only want to keep ERZ914930
I have tried the following:
basename=${line##*/} - This returns contig.fa.gz
base=${line%%/ERZ*} - This returns ftp.sra.ebi.ac.uk/vol1/sequence
with line
being the iteration variable
Thanks!
Hello there!
Your suggestions returns
ERZ914
Thank you
yeah -
-f5
...Op yeah it works now!
Thank you!