Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 Apr 2003 11:47:30 -0600
From:      Matthew Bettinger <mbettinger@championelevators.com>
To:        freebsd-questions@freebsd.org
Subject:   #!sh grep and move files
Message-ID:  <200304031147.30097.mbettinger@championelevators.com>

next in thread | raw e-mail | index | archive | help
Hello,

I am trying to find the best way to search through several thousand files and 
move some to a different directory.  The files are all prefixed with LB.  
Like, LBX99.DAT141683.

These are data transactions and contain one line.  The lines i am trying to 
search for all begin with 

1~TA~  (standing for timeand attendance labor transactions)

 I've tried

#!/usr/bin/sh
for x in `find /dir -type f -exec grep '1~TA' [] \;`
do
mv $x /newdir
done
----------------------------


There  seems to be something i am missing like some output redirection or an 
ls listing... probably alot more.

I know this can be done in a one liner somehow but I need it to be executed 
from cron.

Thanks for any assistance.
Matt




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200304031147.30097.mbettinger>