From owner-freebsd-questions Mon Jun 15 16:19:41 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id QAA18091 for freebsd-questions-outgoing; Mon, 15 Jun 1998 16:19:41 -0700 (PDT) (envelope-from owner-freebsd-questions@FreeBSD.ORG) Received: from scifair.acadiau.ca (scifair.acadiau.ca [131.162.160.32]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id QAA18075 for ; Mon, 15 Jun 1998 16:19:33 -0700 (PDT) (envelope-from miker@scifair.acadiau.ca) Received: from localhost (miker@localhost) by scifair.acadiau.ca (8.8.5/8.8.5) with SMTP id UAA10138; Mon, 15 Jun 1998 20:19:25 -0300 (ADT) Date: Mon, 15 Jun 1998 20:19:25 -0300 (ADT) From: Michael Richards To: Sue Blake cc: freebsd-questions@FreeBSD.ORG Subject: Re: what to learn? In-Reply-To: <19980615133131.11374@welearn.com.au> 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 On Mon, 15 Jun 1998, Sue Blake wrote: > > > ST71d-3.1 > > > ST71d-3.2 > > > ST71d-3.4 # whoops > > > > I am not 100% clear on what you want to do, but a perl script may be > > easier than streams of text processors all iped together. > > > > You could (in perl) > > load the file into an array. > > call sort to order it > > then mess with splitting the - number part off to make sure they don't > > skip any. > > basically I need to isolate the part of each line that I'm interested in, > then, within each group (a page or so), check that they are all alike except > for the number after the dot and that that number is the next one up from > what the previous line said. If it's a short one like ST71d-3 just check > that the part after the hyphen is bigger by one than the part after the > hyphen in the previous line. And quite a few more ifs and buts to take care Well, let's assume your file is space separated... cat filename | awk '{ print $1; }' would print the part you want to look at. Perl would probably work the best but you would benefit more from learning AWK. I know someone else suggested this. Learn AWK. In terms of usefulness, I know people who would write a perl script to sort a list of numbers. Perl has its uses, but in terms of general purpose powerful tools, I find awk a more useful program to have in your toolbox. -Mike To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message