regex - How to grep lines with date formats? -
i have log file created bash script uses $(date)
, there dates in such format:
fri apr 24 22:10:39 cest 2015
the log file looks this:
using scripts_rootdir: /home/gillin/moses/scripts using multi-thread giza using gzip (1) preparing corpus @ fri apr 24 22:10:39 cest 2015 executing: mkdir -p /media/2tb/ccexp/phrase-clustercat-mgiza/work.en-ru/training/corpus (1.0) selecting factors @ fri apr 24 22:10:39 cest 2015 forking... (1.2) creating vcb file /media/2tb/ccexp/phrase-clustercat-mgiza/work.en-ru/training/corpus/en.vcb @ fri apr 24 22:10:39 cest 2015 (1.1) running mkcls @ fri apr 24 22:10:39 cest 2015 /home/gillin/moses/training-tools/mkcls -c50 -n2 -p/media/2tb/ccexp/corpus.exp/train-clean.en -v/media/2tb/ccexp/phrase-clustercat-mgiza/work.en-ru/training/corpus/en.vcb.classes opt executing: /home/gillin/moses/training-tools/mkcls -c50 -n2 -p/media/2tb/ccexp/corpus.exp/train-clean.en -v/media/2tb/ccexp/phrase-clustercat-mgiza/work.en-ru/training/corpus/en.vcb.classes opt (1.1) running mkcls @ fri apr 24 22:10:39 cest 2015 /home/gillin/moses/training-tools/mkcls -c50 -n2 -p/media/2tb/ccexp/corpus.exp/train-clean.ru -v/media/2tb/ccexp/phrase-clustercat-mgiza/work.en-ru/training/corpus/ru.vcb.classes opt executing: /home/gillin/moses/training-tools/mkcls -c50 -n2 -p/media/2tb/ccexp/corpus.exp/train-clean.ru -v/media/2tb/ccexp/phrase-clustercat-mgiza/work.en-ru/training/corpus/ru.vcb.classes opt
is there way such can grep lines contain output of $(date)
?
currently i'm using regex:
[a-z].*[1-9] [0-2][1-9]:[0-6][0-9]:[0-6][0-9] cest 2015
and catches line like
preparing corpus @ fri apr 24 22:10:39 cest 2015
but need full line:
(1) preparing corpus @ fri apr 24 22:10:39 cest 2015
and year , time sort of hard coded. there better regex or unix tool can extract lines $(date)
outputs?
try this:
unalias grep grep --color=never '.*[a-z].*[1-9] [0-2][1-9]:[0-6][0-9]:[0-6][0-9] cest 2015' file
Comments
Post a Comment