linux - How do you use wget to download most up to date file on a site? -


hello trying use wget download update day mcafee patch , having issues singling out .tar file. have:

wget -q -o - ftp://ftp.mcafee.com/pub/antivirus/datfiles/4.x/ | grep -o -m 2 "avvdat-[^\']*" 

however when run above command gives me:

avvdat-8065.tar">avvdat-8065.tar</a>  (95191040 bytes) avvdat-8066.tar">avvdat-8066.tar</a>  (95385600 bytes) 

when need recent.tar file in between <a> </a> in case avvdat-8066.tar. can please me out greping correct .tar not regex or sed.

try this,

wget $(wget -q -o - ftp://ftp.mcafee.com/pub/antivirus/datfiles/4.x/ | grep -eo "ftp://[^\"\]+" | sort | tail -n1) 

Comments