Date: Mon, 15 Jun 1998 20:19:25 -0300 (ADT) From: Michael Richards <miker@scifair.acadiau.ca> To: Sue Blake <sue@welearn.com.au> Cc: freebsd-questions@FreeBSD.ORG Subject: Re: what to learn? Message-ID: <Pine.BSF.3.96.980615201148.10124A-100000@scifair.acadiau.ca> In-Reply-To: <19980615133131.11374@welearn.com.au>
next in thread | previous in thread | raw e-mail | index | archive | help
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. <OPINION>Perl would probably work the best but you would benefit more from learning AWK.</OPINION> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.96.980615201148.10124A-100000>