Welcome to the Linux Foundation Forum!

help on regular expression

hi,

I want to extract some URLs of a txt file with grep --only-matching and regular expression.

I know only some info about the URL, but I definitely know by what it is enclosed.

Example:

AA"$URL"BB

so I use grep -o AA.*BB myfile.txt

But this gives my whole expression (i.e. AA"$URL"BB), but I only want the URL i.e. what is enclosed by AA and BB, how do I do that?

Thanks.

Comments

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Categories

Upcoming Training