cucurbit
cucurbit

Reputation: 1452

remove all between patterns

This is my string:

 ko03008:Ribosome biogenesis in eukaryotes"/kegg-bin/show_pathway?ko03013+K07936" ko03013:RNA transport"/kegg-bin/show_pathway?ko05166+K07936" ko05166:HTLV-I infection"/kegg-bin/show_pathway?ko05169+K07936" ko05169:Epstein-Barr virus infection 

I want to remove the urls "/../.."

This was my last attempt to get it:

sed -e 's/\".*\"//g'

But the output is this:

ko03008:Ribosome biogenesis in eukaryotes ko05169:Epstein-Barr virus infection

Desired output:

 ko03008:Ribosome biogenesis in eukaryotes ko03013:RNA transport ko05166:HTLV-I infection ko05169:Epstein-Barr virus infection

I'm losing information...how can I change my sed command to achieve the desired output?

Upvotes: 1

Views: 60

Answers (2)

repzero
repzero

Reputation: 8402

my version Input

 echo 'ko03008:Ribosome biogenesis in eukaryotes"/kegg-bin/show_pathway?ko03013+K07936" ko03013:RNA transport"/kegg-bin/show_pathway?ko05166+K07936" ko05166:HTLV-I infection"/kegg-bin/show_pathway?ko05169+K07936" ko05169:Epstein-Barr virus infection'  |sed 's/"\/[^ ]*"//g' 

OUTPUT

ko03008:Ribosome biogenesis in eukaryotes ko03013:RNA transport ko05166:HTLV-I infection ko05169:Epstein-Barr virus infection

or

sed 's/"\/[^ ]*"//g' < my_file

Upvotes: 0

whoan
whoan

Reputation: 8531

Here you match the strings starting with "/ and ending with another ".

sed 's#"/[^"]*"##g' file

Example

$ sed 's#"/[^"]*"##g' <<<'ko03008:Ribosome biogenesis in eukaryotes"/kegg-bin/show_pathway?ko03013+K07936" ko03013:RNA transport"/kegg-bin/show_pathway?ko05166+K07936" ko05166:HTLV-I infection"/kegg-bin/show_pathway?ko05169+K07936" ko05169:Epstein-Barr virus infection'
ko03008:Ribosome biogenesis in eukaryotes ko03013:RNA transport ko05166:HTLV-I infection ko05169:Epstein-Barr virus infection

Upvotes: 2

Related Questions