grep help or sed or awk
I am trying to scrape a certain group of web pages for links. Lets say the links I am interested in end in xyz and they begin with a /. I have tried to do this with the following grep command:
grep -o '[//]*xyz' file It doesn't work, because all I get is xyz printed. I think it is possible to do similar things with sed and possibly awk, but I don't know how. Thanks in advance ps: No, I am not doing anything immoral here. |
Usually links don't end in xyz; but grep should work OK for this. Please show us a sample of an actual 'xyz' link that you'd like to match with your regex, and someone can perhaps suggest a regex to match it and similar links.
|
Well, I was using that as an example. What I really want is links that end with "cs0.gif" (Image Files)
|
Not sure how much of the link you want, however, if I have a file named 'links' containing the following:
Code:
sasha@reactor: cat links Code:
sasha@reactor: grep -o -e 'http://.*cs0\.gif' links Cheers! |
Code:
$ ruby -00 -ne 'puts $_.scan(/http.[^>"]*/);' file |
All times are GMT -5. The time now is 06:41 AM. |