From owner-freebsd-questions Thu Aug 3 9:38:47 2000 Delivered-To: freebsd-questions@freebsd.org Received: from mail.telestream.com (mail.telestream.com [205.238.4.5]) by hub.freebsd.org (Postfix) with ESMTP id 2916D37B6A7 for ; Thu, 3 Aug 2000 09:38:43 -0700 (PDT) (envelope-from keith@mail.telestream.com) Received: from localhost (keith@localhost) by mail.telestream.com (8.9.3/8.9.3) with ESMTP id JAA06356; Thu, 3 Aug 2000 09:36:17 -0700 Date: Thu, 3 Aug 2000 09:36:17 -0700 (PDT) From: To: J A Shamsi Cc: questions@FreeBSD.ORG Subject: Re: scripts In-Reply-To: <20000803155918.1816.qmail@web4105.mail.yahoo.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Here's a fishing pole. You'll need to learn to fish though to be able to use it. You could do something like this. Assumes that you are giving the file name on the command line hence the $1. If you need it to find it automaticaly the man page for find will help you. This also assumes 5 fields. #!/usr/local/bin/bash CUT=`cut -f 1,2,3,4,5 -d , $1 NAME=($CUT) If you want to take the ',' out of the delimited portion you can do this. CUT=`cut -f 1,2,3,4,5 -d : $1|sed 's/:/ /g'` NAME=($CUT) That will put all the , delimited fields into an array called NAME which you can access by the array index. Read up on how to access those feilds. Here's the BASH reference manual http://www.gnu.org/manual/bash-2.02/html_mono/bashref.html#SEC115 :-) ================================= Keith W. At the helm My non work related site www.cydonia.net ================================= On Thu, 3 Aug 2000, J A Shamsi wrote: > HI > I am new to shell scripting, > I would like to create a script in bash shell. > that would do the following > > 1) find out the latest file ( text file)in a directory > ( there are bunch of files in a dir) > > 2)open that file (text file) and parse the > values seperated by comma and store them in variables. > > just wondering is there any howto or documenation > available on the web, or if anyone has any idea... > > thanks > > jas > > > __________________________________________________ > Do You Yahoo!? > Kick off your party with Yahoo! Invites. > http://invites.yahoo.com/ > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-questions" in the body of the message > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message