-----BEGIN PGP SIGNED MESSAGE-----
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ On 03-Apr-2003, Matthew Bettinger wrote message "#!sh grep and move files" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > 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 > > Change it to this and it should be ok `find /dir -type f -name 'LB*' | xargs grep -l '^1~TA'` ~~ Andy Harrison [EMAIL PROTECTED] ICQ: 123472 AIM/Y!: AHinMaine [full headers for details] -----BEGIN PGP SIGNATURE----- Version: PGP 6.5.8 iQCVAwUBPox54lPEkLgodAWVAQH46AQAm74ObqXNVSxa4vyuaMQRrlLi7dq6Tx7M 0oIxeG6mifhd92YWLzmYg75urR3dXzZVqIcLJ2EDztQwYxbDjNWNDXlyaEKvxZCq kSycD5Xo9gJTlz+A4Og75wdxBSoQmEU+pFWuIW10+FN72trBTI8Inbtt1TL7fGSz oHMNQFfR1cY= =X/DZ -----END PGP SIGNATURE----- _______________________________________________ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"