Subject:
|
Re: Unix geeks
|
Newsgroups:
|
lugnet.publish
|
Date:
|
Thu, 18 Feb 1999 23:16:16 GMT
|
Viewed:
|
1702 times
|
| |
![Post a public reply to this message](/news/icon-reply.gif) | |
In lugnet.publish, jasper@janssen.dynip.com (Jasper Janssen) writes:
> On Wed, 17 Feb 1999 19:40:12 GMT, lehman@javanet.com (Todd Lehman)
> wrote:
>
> > cat /etc/words | awk '{print substr($0,1,3)}' | sort | uniq -c | sort
>
> Does uniq mess up the sorting? I don't see why you have to pipe it
> through sort twice otherwise. I mean, Yick.
uniq doesn't mess up sorting, no. uniq -c does, though -- in the sense that it
adds an additional field at the front of the line (man uniq). Technically, in
this case, the first sort isn't necessary because the words file is already
sorted, but
|sort|uniq -c|sort
is a pipefitting idiom, so it's easier to type that than to actually have to
stop and think whether the first sort is necessary. :) Also, if you wanted to
see the last three letters of words instead of the first three letters, then
the first sort would indeed be necessary.
cat /etc/words | awk '{print substr($0,length($0)-3,3)}' |sort|uniq -c|sort
> sort is a slow program anyway, so doing it twice where once would do :)
sort is fast enough for me! It sorts the 93398-line, 906524-byte words file on
my system in .49 seconds*. And the total running times of the two pipe chains
shown above are .90 seconds and 1.23 seconds, respectively.
In any case, we're talking about a one-off, so even if it were 10x slower,
that'd still be pretty peachy. The general idea on one-off's is to save
programmer-time rather than CPU-time. :)
--Todd
* wc can chew through the words file in 1/5 the time that sort can, so sort
would be faster in that case if it was smart enough to check for presequenced
input. But who'd pipe a plain old words file into sort anyway? :)
|
|
Message is in Reply To:
![](/news/x.gif) | | Re: Unix geeks
|
| (...) Does uniq mess up the sorting? I don't see why you have to pipe it through sort twice otherwise. I mean, Yick. sort is a slow program anyway, so doing it twice where once would do :) Jasper (25 years ago, 18-Feb-99, to lugnet.publish)
|
58 Messages in This Thread: ![Lego Easter Eggs! -Richard Dee (13-Feb-99 to lugnet.announce, lugnet.loc.uk)](/news/x.gif) ![](/news/246.gif) ![Re: Lego Easter Eggs! -Todd Lehman (13-Feb-99 to lugnet.loc.uk)](/news/x.gif) ![](/news/46.gif) ![Re: Lego Easter Eggs! -Richard Dee (13-Feb-99 to lugnet.loc.uk)](/news/x.gif) ![](/news/46.gif) ![Re: Lego Easter Eggs! -Todd Lehman (13-Feb-99 to lugnet.loc.uk)](/news/x.gif) ![](/news/46.gif) ![Re: Lego Easter Eggs! -Richard Dee (14-Feb-99 to lugnet.publish)](/news/x.gif) ![](/news/246.gif) ![Re: Lego Easter Eggs! -Jasper Janssen (14-Feb-99 to lugnet.publish)](/news/x.gif) ![](/news/246.gif) ![Re: Lego Easter Eggs! -Steve Bliss (15-Feb-99 to lugnet.publish)](/news/x.gif) ![](/news/46.gif) ![Re: Lego Easter Eggs! -Jasper Janssen (16-Feb-99 to lugnet.publish)](/news/x.gif) ![](/news/46.gif) ![Re: Lego Easter Eggs! -Steve Bliss (16-Feb-99 to lugnet.publish)](/news/x.gif) ![](/news/246.gif) ![Re: Lego Easter Eggs! -Anders Isaksson (16-Feb-99 to lugnet.publish)](/news/x.gif) ![](/news/246.gif) ![Re: Lego Easter Eggs! -Steve Bliss (16-Feb-99 to lugnet.publish)](/news/x.gif)
![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/68.gif) ![Re: Lego Easter Eggs! -Richard Dee (17-Feb-99 to lugnet.publish)](/news/x.gif)
![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/x.gif) ![](/news/268.gif) ![Re: Lego Easter Eggs! -Jasper Janssen (16-Feb-99 to lugnet.publish)](/news/x.gif) ![](/news/46.gif) ![Re: Lego Easter Eggs! -Steve Bliss (16-Feb-99 to lugnet.publish)](/news/x.gif) ![](/news/46.gif) ![Re: Lego Easter Eggs! -Jasper Janssen (17-Feb-99 to lugnet.publish)](/news/x.gif)
![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/x.gif) ![](/news/268.gif) ![Re: Lego Easter Eggs! -Bram Lambrecht (17-Feb-99 to lugnet.publish)](/news/x.gif) ![](/news/46.gif) ![Re: Lego Easter Eggs! -Mike Stanley (17-Feb-99 to lugnet.publish)](/news/x.gif)
![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/x.gif) ![](/news/68.gif) ![Re: Lego Easter Eggs! -Mike Stanley (17-Feb-99 to lugnet.publish)](/news/x.gif) ![](/news/46.gif) ![Re: Lego Easter Eggs! -John DiRienzo (17-Feb-99 to lugnet.publish)](/news/x.gif)
![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/68.gif) ![Re: Lego Easter Eggs! -Richard Dee (15-Feb-99 to lugnet.publish)](/news/x.gif) ![](/news/46.gif) ![Re: Lego Easter Eggs! -Jasper Janssen (16-Feb-99 to lugnet.publish)](/news/x.gif)
![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/x.gif) ![](/news/68.gif) ![Re: Lego Easter Eggs! -Larry Pieniazek (16-Feb-99 to lugnet.publish)](/news/x.gif) ![](/news/246.gif) ![Re: Lego Easter Eggs! -Jasper Janssen (16-Feb-99 to lugnet.publish)](/news/x.gif)
![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/x.gif) ![](/news/68.gif) ![Re: Lego Easter Eggs! -Steve Bliss (16-Feb-99 to lugnet.publish)](/news/x.gif) ![](/news/46.gif) ![Re: Lego Easter Eggs! -Jasper Janssen (16-Feb-99 to lugnet.publish)](/news/x.gif) ![](/news/46.gif) ![Re: Lego Easter Eggs! -Steve Bliss (16-Feb-99 to lugnet.publish)](/news/x.gif) ![](/news/46.gif) ![Re: Lego Easter Eggs! -Jasper Janssen (17-Feb-99 to lugnet.publish)](/news/x.gif) ![](/news/46.gif) ![Re: Lego Easter Eggs! -Steve Bliss (17-Feb-99 to lugnet.publish)](/news/x.gif) ![](/news/246.gif) ![Re: Lego Easter Eggs! -Mike Stanley (17-Feb-99 to lugnet.publish)](/news/x.gif) ![](/news/46.gif) ![Re: Lego Easter Eggs! -Steve Bliss (17-Feb-99 to lugnet.publish)](/news/x.gif) ![](/news/46.gif) ![Unix geeks -Todd Lehman (17-Feb-99 to lugnet.publish)](/news/x.gif) ![](/news/46.gif) ![Re: Unix geeks -Jasper Janssen (18-Feb-99 to lugnet.publish)](/news/x.gif) ![](/news/246.gif) ![Re: Unix geeks -Larry Pieniazek (18-Feb-99 to lugnet.publish, lugnet.off-topic.fun)](/news/x.gif) ![](/news/46.gif) ![Re: Unix geeks -Jasper Janssen (19-Feb-99 to lugnet.publish, lugnet.off-topic.fun)](/news/x.gif)
![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/x.gif) ![](/news/268.gif) ![Re: Unix geeks -Alan Shutko (18-Feb-99 to lugnet.publish, lugnet.off-topic.fun)](/news/x.gif) ![](/news/46.gif) ![Re: Unix geeks -Larry Pieniazek (18-Feb-99 to lugnet.publish, lugnet.off-topic.fun)](/news/x.gif)
![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/x.gif) ![](/news/68.gif) ![You are here](/news/here.gif)
![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/x.gif) ![](/news/68.gif) ![Case-sensitivity in programming languages -Todd Lehman (17-Feb-99 to lugnet.publish)](/news/x.gif) ![](/news/46.gif) ![Re: Case-sensitivity in programming languages -Steve Bliss (17-Feb-99 to lugnet.publish)](/news/x.gif) ![](/news/46.gif) ![Re: Case-sensitivity in programming languages -Todd Lehman (18-Feb-99 to lugnet.publish)](/news/x.gif) ![](/news/246.gif) ![Re: Case-sensitivity in programming languages -Roy Earls (18-Feb-99 to lugnet.publish)](/news/x.gif) ![](/news/46.gif) ![Re: Case-sensitivity in programming languages -Jasper Janssen (18-Feb-99 to lugnet.publish)](/news/x.gif)
![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/x.gif) ![](/news/268.gif) ![Re: Case-sensitivity in programming languages -Steve Bliss (18-Feb-99 to lugnet.publish)](/news/x.gif) ![](/news/46.gif) ![Re: Case-sensitivity in programming languages -Roy Earls (19-Feb-99 to lugnet.publish)](/news/x.gif) ![](/news/46.gif) ![Re: Case-sensitivity in programming languages -Steve Bliss (19-Feb-99 to lugnet.publish)](/news/x.gif)
![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/x.gif) ![](/news/268.gif) ![Re: Case-sensitivity in programming languages -Steve Bliss (18-Feb-99 to lugnet.publish)](/news/x.gif)
![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/x.gif) ![](/news/68.gif) ![Re: Case-sensitivity in programming languages -Roy Earls (19-Feb-99 to lugnet.publish)](/news/x.gif) ![](/news/246.gif) ![Re: Case-sensitivity in programming languages -Jasper Janssen (20-Feb-99 to lugnet.publish)](/news/x.gif)
![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/x.gif) ![](/news/68.gif) ![Re: Case-sensitivity in programming languages -Roy Earls (20-Feb-99 to lugnet.publish)](/news/x.gif)
![](/news/x.gif) ![](/news/268.gif) ![Re: Lego Easter Eggs! -Jason Spangler (13-Feb-99 to lugnet.loc.uk, lugnet.announce)](/news/x.gif)
![](/news/x.gif) ![](/news/268.gif) ![Re: Lego Easter Eggs! -Huw Millington (13-Feb-99 to lugnet.loc.uk)](/news/x.gif) ![](/news/46.gif) ![Re: Lego Easter Eggs! -Richard Dee (13-Feb-99 to lugnet.loc.uk)](/news/x.gif) ![](/news/246.gif) ![Re: Lego Easter Eggs! -Simon Denscombe (14-Feb-99 to lugnet.loc.uk)](/news/x.gif) ![](/news/46.gif) ![Re: Lego Easter Eggs! -Richard Dee (14-Feb-99 to lugnet.loc.uk)](/news/x.gif)
![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/x.gif) ![](/news/68.gif) ![Re: Lego Easter Eggs! -Huw Millington (14-Feb-99 to lugnet.loc.uk)](/news/x.gif) ![](/news/46.gif) ![Re: Lego Easter Eggs! -Richard Dee (14-Feb-99 to lugnet.loc.uk)](/news/x.gif) ![](/news/46.gif) ![Re: Lego Easter Eggs! -Steve Scott (14-Feb-99 to lugnet.loc.uk)](/news/x.gif)
![](/news/x.gif) ![](/news/68.gif) ![Re: Lego Easter Eggs! -Huw Millington (27-Feb-99 to lugnet.loc.uk)](/news/x.gif)
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|