I have a server log that outputs
Code:
`/bin/date +%H%M` `/bin/date +%d` $SDB $SDC $SDD $SDE"
and the log file looks:
Code:
0540 13 33 33 35 36
0541 13 33 33 35 35
0542 13 33 33 35 36
0543 13 33 33 35 35
0544 13 32 33 35 35
0545 13 33 33 35 36
0546 13 33 33 35 36
0547 13 33 33 35 36
0548 13 33 33 35 35
The second value is the day in 1-31 format. Now I want to truncate the file at midnight so I only have that days data in this specific log file.
The original log file has thousands of entries that spans weeks and I am looking for a script that will take massive.log and take only the latest days info and make daily.log.
Ex:
Code:
cat massive.log | grep '/bin/date +%d' > daily.log
Something along that line would work perfectly EXCEPT I cannot use the '/bin/date' part in the command. I have seen many console examples such as
Code:
apt-get remove -f 'dpkg -l | grep i18n'
As a way to remove the searched packages but once again the console says cannot find 'dpkg -l | grep i18n' is their something obvious im missing??