if the input file represents something like:
$ cat file.in 2014-03-25T09:51:34 line1 2014-03-25T09:51:34 line2 2016-01-07T01:01:01 line3
and the date is older than today, it is necessary to replace it with the current time, then you can use the following script:
$ cat script date=/bin/date infile=./file.in outfile=./file.out # %s — это секунды с начала unix-эпохи polnoch=$($date -d "00:00" +%s) cat $infile | while read ds; do secs=$($date -d $d +%s) if [[ $polnoch -gt $secs ]]; then d=$($date +%FT%T) fi echo $d $s done > $outfile
after its launch:
$ bash script
in the output file we get:
$ cat file.out 2016-01-07T00:33:59 line1 2016-01-07T00:33:59 line2 2016-01-07T01:01:01 line3
if not another time is required, but some other time, then the line should be corrected accordingly:
d=$($date +%FT%T)