RE: Specifying sort fields

2004-04-23 Thread JJB
Thank you that worked. You know that nowhere in the 'man sort' info
does it say that to use sort command you have to use pipe commands
to feed it data. How is somebody without UNIX programming background
going to read that and know how to feed sort it's data to sort?
Don't you think the man sort info needs updating to explain this
fact?  Even some examples at end of technical info would go long way
to making the 'man sort' info user friendly and meaningfully.

-Original Message-
From: Dan Nelson [mailto:[EMAIL PROTECTED]
Sent: Thursday, April 22, 2004 5:35 PM
To: JJB
Cc: [EMAIL PROTECTED] ORG
Subject: Re: Specifying sort fields

In the last episode (Apr 22), JJB said:
 How to specify the  fields the sort program is to sort on?

 My file has blanks between the fields and I want to sort on
 field number 9 which is ip address.

 I want to sort filea and put results in fileb.

 A sample of the sort command  to be used from the command line
would
 go an long way to understanding how to use it.

Somthing like sort -k 9bn  filea  fileb should work, but it will
end up sorting only the first octect.  If you can get your addresses
to
be 0-padded (000.000.000.000), you can drop the 'n' from the sort
command and just do a plain ascii sort.

--
Dan Nelson
[EMAIL PROTECTED]

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Specifying sort fields

2004-04-23 Thread Dan Nelson
In the last episode (Apr 23), JJB said:
 Thank you that worked. You know that nowhere in the 'man sort' info
 does it say that to use sort command you have to use pipe commands to
 feed it data. How is somebody without UNIX programming background
 going to read that and know how to feed sort it's data to sort? Don't
 you think the man sort info needs updating to explain this fact? 
 Even some examples at end of technical info would go long way to
 making the 'man sort' info user friendly and meaningfully.

Well, it does, sort of:

SYNOPSIS
   sort [OPTION]... [FILE]...

DESCRIPTION
   Write sorted concatenation of all FILE(s) to standard output.

and a bit farther down:

   With no FILE, or when FILE is -, read standard input.

I agree that examples would be nice.

-- 
Dan Nelson
[EMAIL PROTECTED]
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Specifying sort fields

2004-04-23 Thread Kirk Strauser
At 2004-04-23T13:00:17Z, JJB [EMAIL PROTECTED] writes:

 Thank you that worked. You know that nowhere in the 'man sort' info does
 it say that to use sort command you have to use pipe commands to feed it
 data.

It doesn't because you don't.  The syntax is:

sort [OPTION]... [FILE]...

which means that you may optionally specify the name of the file to process.
For what it's worth, the wide majority of Unix commands accept input from
pipes and can write output to pipes.
-- 
Kirk Strauser

94 outdated ports on the box,
 94 outdated ports.
 Portupgrade one, an hour 'til done,
 82 outdated ports on the box.


pgp0.pgp
Description: PGP signature


RE: Specifying sort fields

2004-04-23 Thread Warren Block
On Fri, 23 Apr 2004, JJB wrote:

 Thank you that worked. You know that nowhere in the 'man sort' info
 does it say that to use sort command you have to use pipe commands
 to feed it data.

You don't have to use pipes or redirection:

sort -n /etc/hosts

 Don't you think the man sort info needs updating to explain this
 fact?  Even some examples at end of technical info would go long way
 to making the 'man sort' info user friendly and meaningfully.

man send-pr

-Warren Block * Rapid City, South Dakota USA
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Specifying sort fields

2004-04-22 Thread Dan Nelson
In the last episode (Apr 22), JJB said:
 How to specify the  fields the sort program is to sort on?
 
 My file has blanks between the fields and I want to sort on
 field number 9 which is ip address.
 
 I want to sort filea and put results in fileb.
 
 A sample of the sort command  to be used from the command line would
 go an long way to understanding how to use it.

Somthing like sort -k 9bn  filea  fileb should work, but it will
end up sorting only the first octect.  If you can get your addresses to
be 0-padded (000.000.000.000), you can drop the 'n' from the sort
command and just do a plain ascii sort.

-- 
Dan Nelson
[EMAIL PROTECTED]
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]