Reputation: 92
I make this regular inside a file and it shows line:
sed -n "/href=\"\(openswitch-disk-image-genericx86-64-0.1.0\+.*\.tar\.gz\)\"/p" index.html
But if I do this it shows nothing:
sed -n "s/href=\"\(openswitch-disk-image-genericx86-64-0.1.0\+.*\.tar\.gz\)\"/\1/g" index.html
What am I doing wrong here?
Upvotes: 0
Views: 51
Reputation: 92
I ended up using perl -nle like this:
perl -nle 'print $1 if /href="(openswitch-disk-image-genericx86-64-0.1.0+[0-9]+.tar.gz)"/' index.html
Upvotes: 1
Reputation: 246774
I'm not sure how to bend sed to do that. However grep's -o
flag is made just for this
grep -o "openswitch-disk-image-genericx86-64-0.1.0\+.*\.tar\.gz" index.html
It's not clear if you want "one or more zeros" or "zero followed by plus"
Upvotes: 0