Hi
I have downloaded a HTM file from the web.
What I want to do is perform a grep search of that file, searching for all strings where 'http' is present within the file, but only contains the word 'cache' within the string.
I've includeda sample file, which I'm trying to extract the above result from
This is what I can think of at the moment codewise (lame I know)
grep "http" (don't know how to search for 'cache') > results.html
Thanks
C.
Maybe:
[house@leonov] grep -o 'http://.*cache.*/' data.html
http://v4.lscache3.c.youtube.com/
http://v4.lscache8.c.youtube.com/
http://v14.lscache7.c.youtube.com/
http://v4.lscache3.c.youtube.com/
http://v4.lscache8.c.youtube.com/
http://v14.lscache7.c.youtube.com/
i only need to capture the last instance of the HTTP addresss, that contains 'cache', is there a switch for this ?
[house@leonov] grep -o 'http://.*cache.*/' data.html | tail -n 1
http://v14.lscache7.c.youtube.com/
grep http youtube3.html |grep cache
awk '/http/&&/cache/' youtube3.html
Only last instance by one command:
awk '/http/&&/cache/ {a=$0}END{print a}' youtube3.html
Why do I have to use 'awk' can this request not be implemented within a grep command ?