using -t option with unix sort ?

2009-02-09 Thread Pavel Zelenov

This works:

sort -t `/bin/echo '\t'` 


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


using -t option with unix sort ?

2005-07-14 Thread Daniel Malaby

Hi All,

I am trying to sort a tab delimited file with sort. The problem I am
having is with the -t option. I do not know how to pass a tab.

Things I have tried:

sort -t \t
sort -t '\t'
sort -t \t
sort -t 0x09
sort -t '0x09'
sort -t 0x09
sort -t ^I
sort -t '^I'
sort -t ^I

Any suggestions would be much appreciated.

Thanks

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


Re: using -t option with unix sort ?

2005-07-14 Thread Nelis Lamprecht
On 7/14/05, Daniel Malaby [EMAIL PROTECTED] wrote:
 Hi All,
 
 I am trying to sort a tab delimited file with sort. The problem I am
 having is with the -t option. I do not know how to pass a tab.

snip

 sort -t \t

/snip

 
 Any suggestions would be much appreciated.

remove the space between -t and \t and it should work

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


Re: using -t option with unix sort ?

2005-07-14 Thread Nelis Lamprecht
On 7/14/05, Nelis Lamprecht [EMAIL PROTECTED] wrote:
 On 7/14/05, Daniel Malaby [EMAIL PROTECTED] wrote:
  Hi All,
 
  I am trying to sort a tab delimited file with sort. The problem I am
  having is with the -t option. I do not know how to pass a tab.
 
 snip
 
  sort -t \t
 
 /snip
 
 
  Any suggestions would be much appreciated.
 
 remove the space between -t and \t and it should work

actually scratch that, it works either way. can you give a sample of the data ?

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


Re: using -t option with unix sort ?

2005-07-14 Thread Daniel Malaby



Nelis Lamprecht wrote:

On 7/14/05, Nelis Lamprecht [EMAIL PROTECTED] wrote:


On 7/14/05, Daniel Malaby [EMAIL PROTECTED] wrote:


Hi All,

I am trying to sort a tab delimited file with sort. The problem I am
having is with the -t option. I do not know how to pass a tab.


snip


sort -t \t


/snip


Any suggestions would be much appreciated.


remove the space between -t and \t and it should work



actually scratch that, it works either way. can you give a sample of the data ?

Regards,
Nelis


The sample data has 9 fields, I am trying to sort on the fifth field, 
here is what I have tried.


sort -t\t +4 -5 -o test.txt sample.txt

I did try removing the space and it did not work, I have also tried 
removing the -5. I think the spaces in the third field are confusing sort.


BTW this is being done on a PC running FBSD 4.11 prerelease #1

Thanks for your help and suggestions.

E00219085   GENERAL DYNAMICS5031802 E-GL/VX/B/R1.0  SFT CD, GL 
VXWORKS BOREALIS R1.006/30/05 1  $995.00 $995.00
E01619096   TGA INGENIERIA Y ELECTRONICS S  5881-2  E-AD600729C501  ARGUS 
PMC,2 DVI 16MB PERCHAN USB A/V12/01/0530  $2,312.00   
$69,360.00
E01619096   TGA INGENIERIA Y ELECTRONICS S  5881-2  E-DDX/SO/R4.0   SFT CD, 
DDX SOL 2.6-9 BOREALIS R4.0 12/01/0530  $74.00  $2,220.00
E01619096   TGA INGENIERIA Y ELECTRONICS S  5881-2  E-VIN/SO/R1.0   SFT CD, 
VID CAP SOL 2.6-9 BOREALIS R1.0 12/01/0530  $74.00  $2,220.00
E02119093   GANYMED COMPUTER GMBH   7103879 E-AD90073913011 GARNET PMC RIO8 
C2, REAR I/O 16MB   07/19/05 2  $1,848.00   $3,696.00
E02419080   DRS LAUREL TECHNOLOGIES 94358   E-AC7007121115A ECLIPSE3 PMC, 
VGA 16MB Q70  08/18/05 1  $846.00 $846.00
E02419080   DRS LAUREL TECHNOLOGIES 94358   E-AC7007121115A ECLIPSE3 PMC, 
VGA 16MB Q70  10/19/0519  $846.00 $16,074.00
E02419080   DRS LAUREL TECHNOLOGIES 94358   E-AC7007121115A ECLIPSE3 PMC, 
VGA 16MB Q70  09/20/05 2  $846.00 $1,692.00
E02419080   DRS LAUREL TECHNOLOGIES 94358   E-AC7007121115A ECLIPSE3 PMC, 
VGA 16MB Q70  11/17/05 7  $846.00 $5,922.00
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]

Re: using -t option with unix sort ?

2005-07-14 Thread Tsampros Leonidas
On Thu, Jul 14, 2005 at 10:47:50AM -0700, Daniel Malaby wrote:
 
 
 Nelis Lamprecht wrote:
 On 7/14/05, Nelis Lamprecht [EMAIL PROTECTED] wrote:
 
 On 7/14/05, Daniel Malaby [EMAIL PROTECTED] wrote:
 

sniiip

 E002  19085   GENERAL DYNAMICS5031802 E-GL/VX/B/R1.0  SFT CD, GL 
 VXWORKS BOREALIS R1.006/30/05 1  $995.00 $995.00
 E016  19096   TGA INGENIERIA Y ELECTRONICS S  5881-2  E-AD600729C501  ARGUS 
 PMC,2 DVI 16MB PERCHAN USB A/V12/01/0530  $2,312.00   
 $69,360.00
 E016  19096   TGA INGENIERIA Y ELECTRONICS S  5881-2  E-DDX/SO/R4.0   SFT CD, 
 DDX SOL 2.6-9 BOREALIS R4.0 12/01/0530  $74.00  $2,220.00
 E016  19096   TGA INGENIERIA Y ELECTRONICS S  5881-2  E-VIN/SO/R1.0   SFT CD, 
 VID CAP SOL 2.6-9 BOREALIS R1.0 12/01/0530  $74.00  $2,220.00
 E021  19093   GANYMED COMPUTER GMBH   7103879 E-AD90073913011 GARNET PMC RIO8 
 C2, REAR I/O 16MB   07/19/05 2  $1,848.00   $3,696.00
 E024  19080   DRS LAUREL TECHNOLOGIES 94358   E-AC7007121115A ECLIPSE3 PMC, 
 VGA 16MB Q70  08/18/05 1  $846.00 $846.00
 E024  19080   DRS LAUREL TECHNOLOGIES 94358   E-AC7007121115A ECLIPSE3 PMC, 
 VGA 16MB Q70  10/19/0519  $846.00 $16,074.00
 E024  19080   DRS LAUREL TECHNOLOGIES 94358   E-AC7007121115A ECLIPSE3 PMC, 
 VGA 16MB Q70  09/20/05 2  $846.00 $1,692.00
 E024  19080   DRS LAUREL TECHNOLOGIES 94358   E-AC7007121115A ECLIPSE3 PMC, 
 VGA 16MB Q70  11/17/05 7  $846.00 $5,922.00


Are you sure that these columns are tab delimited ? 

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


Re: using -t option with unix sort ?

2005-07-14 Thread jdyke

Tsampros Leonidas wrote:

On Thu, Jul 14, 2005 at 10:47:50AM -0700, Daniel Malaby wrote:



Nelis Lamprecht wrote:


On 7/14/05, Nelis Lamprecht [EMAIL PROTECTED] wrote:



On 7/14/05, Daniel Malaby [EMAIL PROTECTED] wrote:




sniiip


E00219085   GENERAL DYNAMICS5031802 E-GL/VX/B/R1.0  SFT CD, GL 
VXWORKS BOREALIS R1.006/30/05 1  $995.00 $995.00
E01619096   TGA INGENIERIA Y ELECTRONICS S  5881-2  E-AD600729C501  ARGUS 
PMC,2 DVI 16MB PERCHAN USB A/V12/01/0530  $2,312.00   
$69,360.00
E01619096   TGA INGENIERIA Y ELECTRONICS S  5881-2  E-DDX/SO/R4.0   SFT CD, 
DDX SOL 2.6-9 BOREALIS R4.0 12/01/0530  $74.00  $2,220.00
E01619096   TGA INGENIERIA Y ELECTRONICS S  5881-2  E-VIN/SO/R1.0   SFT CD, 
VID CAP SOL 2.6-9 BOREALIS R1.0 12/01/0530  $74.00  $2,220.00
E02119093   GANYMED COMPUTER GMBH   7103879 E-AD90073913011 GARNET PMC RIO8 
C2, REAR I/O 16MB   07/19/05 2  $1,848.00   $3,696.00
E02419080   DRS LAUREL TECHNOLOGIES 94358   E-AC7007121115A ECLIPSE3 PMC, 
VGA 16MB Q70  08/18/05 1  $846.00 $846.00
E02419080   DRS LAUREL TECHNOLOGIES 94358   E-AC7007121115A ECLIPSE3 PMC, 
VGA 16MB Q70  10/19/0519  $846.00 $16,074.00
E02419080   DRS LAUREL TECHNOLOGIES 94358   E-AC7007121115A ECLIPSE3 PMC, 
VGA 16MB Q70  09/20/05 2  $846.00 $1,692.00
E02419080   DRS LAUREL TECHNOLOGIES 94358   E-AC7007121115A ECLIPSE3 PMC, 
VGA 16MB Q70  11/17/05 7  $846.00 $5,922.00




Are you sure that these columns are tab delimited ? 


likely not, but sort will grab each white space delimited column, so if
INGENIERIA Y ELECTRONICS is really a single value, you're not going to be able 
to sort that with say `cat file | sort +4`


i think i may have missed some of this thread, but this document would likely 
need some formatting with sed(1) before sort could do its magic.  with sed, 
using the substitute operator, you could grab the proper colmns, wrap them in 
quotes and pass that to sort.


the -t operator, passed a tab as in earier mails will not work as tab is still a 
blank to non blank transistion.


hth
jeff



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


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


Re: using -t option with unix sort ?

2005-07-14 Thread Csaba Henk
On Thu, Jul 14, 2005 at 10:47:50AM -0700, Daniel Malaby wrote:
 The sample data has 9 fields, I am trying to sort on the fifth field, 
 here is what I have tried.
 
 sort -t\t +4 -5 -o test.txt sample.txt
 
 I did try removing the space and it did not work, I have also tried 
 removing the -5. I think the spaces in the third field are confusing sort.

Well, if you are willing to accept a non-orthodox solution,

ruby -e 'puts $.readlines.sort_by {|x| x.split(/\t/)[4]}' sample.txt  test.txt

will do the job.

I guess there should be a succint way of doing this with perl, too.

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