The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Stumped JeffR Shell Programming and Scripting 3 05-30-2008 06:01 PM
RegEx question has me stumped tolmark UNIX for Dummies Questions & Answers 7 08-18-2007 03:20 PM
httpd.conf - stumped Cameron IP Networking 2 04-25-2002 02:31 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #15  
Old 05-20-2008
Registered User
 

Join Date: Jan 2008
Posts: 68
Thanks for the reply, if the pipe to sort and getline command won't work, is there another way to sort this for ouput?
Reply With Quote
Forum Sponsor
  #16  
Old 05-20-2008
era era is offline
Herder of Useless Cats
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,650
You already do, just don't redirect to a temporary file?
Reply With Quote
  #17  
Old 05-21-2008
Registered User
 

Join Date: Jan 2008
Posts: 68
era,
You are correct. If I don't output to a file the indices output in sorted order and only the indices are output. But that is not the end result I was wanting. I was hoping that sorting the indices and assigning in a different array, I would be able to output the indices and the elements in sorted order, but as you can see above it does not work. I was thinking that awk outputted the indices in the order they were assigned, but that appears to not be the case. Still stuck on this one, still hoping someone can help me out with it.
Reply With Quote
  #18  
Old 05-21-2008
Ygor's Avatar
Moderator
 

Join Date: Oct 2003
Location: -31.96,115.84
Posts: 1,249
Gawk has functions for array sorting: asort() and asorti()
Reply With Quote
  #19  
Old 05-21-2008
era era is offline
Herder of Useless Cats
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,650
Or change the output format and/or the sort command line so that it does sort them into the right order. One common hack is to add a field to force a particular sort order, then in the end game throw away that field again.
Reply With Quote
  #20  
Old 05-22-2008
Registered User
 

Join Date: Jan 2008
Posts: 68
Ygor,
Gawk is not a option for me on this one. Thanks for the info.

era,
thanks. I will give that a try, but I am a little confused on how to do it with the indices that I need to sort, but will give it a try none the less.
Reply With Quote
  #21  
Old 05-26-2008
Registered User
 

Join Date: Jan 2008
Posts: 68
still having issue's, can someone help with this?
Reply With Quote
Google The UNIX and Linux Forums
Reply

Tags
linux

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 12:08 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0