Linux.com

fux

fux

  • Linux.com Member
  • Posts: 1
  • Member Since: 29 Apr 13
  • Last Logged In: 29 Apr 13

Latest Posts

Posted by
Topic
Post Preview
Posted
  • fux
    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.
    Link to this post 29 Apr 13

    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.

Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board