From owner-freebsd-questions@FreeBSD.ORG Wed Apr 25 11:23:40 2007 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6889716A400 for ; Wed, 25 Apr 2007 11:23:40 +0000 (UTC) (envelope-from derek@computinginnovations.com) Received: from betty.computinginnovations.com (mail.computinginnovations.com [64.81.227.250]) by mx1.freebsd.org (Postfix) with ESMTP id 0C01B13C45E for ; Wed, 25 Apr 2007 11:23:37 +0000 (UTC) (envelope-from derek@computinginnovations.com) Received: from p28.computinginnovations.com (dhcp-10-20-30-100.computinginnovations.com [10.20.30.100]) (authenticated bits=0) by betty.computinginnovations.com (8.13.8/8.12.11) with ESMTP id l3PBMl2M019545; Wed, 25 Apr 2007 06:22:48 -0500 (CDT) Message-Id: <6.0.0.22.2.20070425061655.0264d980@mail.computinginnovations.com> X-Sender: derek@mail.computinginnovations.com X-Mailer: QUALCOMM Windows Eudora Version 6.0.0.22 Date: Wed, 25 Apr 2007 06:21:52 -0500 To: Gary Kline , FreeBSD Mailing List From: Derek Ragona In-Reply-To: <20070425072914.GA65634@thought.org> References: <20070425072914.GA65634@thought.org> Mime-Version: 1.0 X-ComputingInnovations-MailScanner-Information: Please contact the ISP for more information X-ComputingInnovations-MailScanner: Found to be clean X-ComputingInnovations-MailScanner-From: derek@computinginnovations.com X-Spam-Status: No Content-Type: text/plain; charset="us-ascii"; format=flowed X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: Subject: Re: first of misc questions.... X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Apr 2007 11:23:40 -0000 At 02:29 AM 4/25/2007, Gary Kline wrote: > Guys, > > This is an awk-type question. Hopefully a one-liner. If I > need to use #!/usr/bin/awk and a BEGIN/END (or whatever it is), > that's okay... > > I want to do an ls -l in a /home/kline/ and find and > edit files that are dated (let's say) Apr 19 or Mar 26. This > works to print $9 the filenames. > > ls -l| awk '{if ($6 == "Apr" && $7 == 19 || $6 == "Mar" && $7 > == 26 ) print $9}' > > What's the final part to get awk to vi $9? Or another pipe and > xargs and "vi"? Nothing simple works, so thanks for any > clues! I would use a simple approach incase you need to re-edit the list since editing will change file times: ls -l| awk '{if ($6 == "Apr" && $7 == 19 || $6 == "Mar" && $7 == 26 ) print $9}' > /tmp/myfilelist then you can: for i in `cat /tmp/myfilelist`;do vi $i;done if you don't want to use a file, you can do in one shell loop too, but again this will change your file modification times: for i in `ls -l| awk '{if ($6 == "Apr" && $7 == 19 || $6 == "Mar" && $7 == 26 ) print $9}'`;do vi $i;done -Derek -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. MailScanner thanks transtec Computers for their support.