1

extract lines using date range

view story
linux-howto

http://www.linuxquestions.org – I wish to extract lines from files based on date from first two fields eg: lines with todays date or week ago etc eg of file: Jul 17 gfgf gfdg sdfg Jul 11 Jul 17 sdfd dfg Jul 11 fdf Jul 17 ffgg ggg Jul 16 gfg Jul 16 gfg ffg fdg Jul 17 I used awk suppose for todays date: k=`date '+%B %d'` awk -v m="$k" '($1,$2) == m' file For a week before: k=`date --date=="7 days ago" +%b\ %e` awk -v m="$k" '($1,$2) == m' file For user to enter date for search echo "enter month" read mon echo "enter date" read dat awk -v "m=$mon" "d=$ (HowTos)