Afficher un message
Vieux 08/01/2008, 08h18   #3
mik3l3374@gmail.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: searching for lines > 45 days

On Jan 8, 7:32 am, Peter <petercri...@yahoo.com> wrote:
> I have a field in a text file 11:39:16 2007-10-07. Is there anyway to
> use grep or a similiar tool to extract all lines over 45 days to
> another file and remove them from the original file ?
>
> Thanks,
> Pete


#!/bin/sh

t=`echo "11:39:16 2007-10-07" | sed 's/[:-]/ /g'`
set -- $t
string="$4$5$6$1$2"
touch tempfile
touch -t $string tempfile
result=`find . -mtime +45 -ls |grep tempfile > /dev/null`
if [ "$result" -eq 0 ];then
echo "Found line"
rm tempfile
fi
  Réponse avec citation
 
Page generated in 0,04618 seconds with 9 queries