From owner-freebsd-questions Sun Jun 14 19:11:30 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id TAA18173 for freebsd-questions-outgoing; Sun, 14 Jun 1998 19:11:30 -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 TAA18118 for ; Sun, 14 Jun 1998 19:10:50 -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 XAA08544; Sun, 14 Jun 1998 23:10:35 -0300 (ADT) Date: Sun, 14 Jun 1998 23:10:35 -0300 (ADT) From: Michael Richards To: Sue Blake cc: freebsd-questions@FreeBSD.ORG Subject: Re: what to learn? In-Reply-To: <19980615085554.56310@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: > I have a large text file (2-3 megs) with numbers at the beginning of lines. > Currently I'm reading through this file, checking that the numbers go in > sequence, detecting errors but not fixing. This file has a long history of > cutting and pasting without always updating the codes properly :-( So does this mean you want only to know where the errors lie, or you want to fix it? My first approach would be simply to pipe it through sort. I have been known to do all kinds of wierd stuff with awk, and cut. > 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. Assuming of course this is what you wanted to do. There are a number of ways to attack this... -Mike To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message