Skip to main content

All Questions

Tagged with
0 votes
2 answers
3k views

Compare dates using awk in bash

I have a file and each line has some info and a date,so what I want is to print the lines with dates after a given date. I use this awk command sort -t$'|' -k5 $2 | awk -F '|' -v DatedAfter=$4 '!/^#/ ...
Μάριος Τσοκανάς's user avatar
0 votes
1 answer
1k views

How to see the lines whose date column is less than x day from today

My file ID=29524 02/12/2015,23:59:34,'PAt, 0, ID=29628 02/12/2015,23:59:37,'PAb, 1.9, ID=30816 03/12/2015,00:00:20,'PAc, 4.15, I would like to print files with X days less than from today. My try is ...
asitm9's user avatar
  • 1
2 votes
3 answers
5k views

change of date format in awk command

I have a file mdn.txt with following sample record. mdn.txt: 123456,2711448,1,20150214092425,20150714092425,120,20150814163821,,123,,,123,20150214092425,,123,,,123,20150214092425,,123,Y Now I want ...
user3548033's user avatar
2 votes
3 answers
1k views

Truncating the precision of a date

I'm working with a bash script which polls build progress from several different systems. If a build is complete, it stats a log file to find out the last time it was edited, then feeds that time into ...
arthropodSeven's user avatar
1 vote
1 answer
230 views

How to accumulate data for the previous x number of days

Q: For the argument of the question, say today is 26/03/15. How can I 'accumulate' data for the last 5 days. But these dates are just an example. Ideally I would like to be able to accumulate data for ...
3kstc's user avatar
  • 4,976
4 votes
4 answers
14k views

How to subtract two times in shell

I nee to subtract two lines which is in the format of time in shell. The time format is hh:mm:ss I used the code below to get the time. cat /var/log/kern.log |grep usb |tail -2| awk '{print $3}' The ...
Rakesh R Nair's user avatar