Congratulations to AcaCandy on her 100,000th post!
There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
acer black screen blue screen boot bsod computer connection crash css dell display drive driver drivers email error ethernet excel firefox firefox 3 game hard drive internet internet explorer itunes laptop linux malware monitor network networking nvidia outlook outlook 2003 outlook 2007 outlook express partition problem router slow software sound trojan usb video virus vista windows windows xp wireless
UNIX/Linux
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Operating Systems > UNIX/Linux >
Sort command help


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

Closed Thread
 
Thread Tools
xMikex's Avatar
Senior Member with 152 posts.
 
Join Date: Nov 2005
Experience: Intermediate
07-Mar-2008, 01:52 PM #1
Sort command help
Hey guys im having some trouble completing a sorting job on one of my files( the data is fake its just so I can test out how to do it)

William Donald 960WaydrColoradoSpringsCO80920 DesertCamoBPProd77778 719-689-9980
Mary Whitmore 1001StatonlnColoradoSpringsCO80920 BabyBlueBPProd77765 719-456-5000
Diego Torres 2360SanteFeBuenosAiresArgentina BlackRedBPProd77722 +54-4000-6800
Sven Ericsson 2953BeitstolenBeitstolenNorway BlackBPProd77721 +47-61-35-30-00


Anyways I want to sort it by last name so basically in this case sven ericsson should be on top of whitmore. However I have tried several different sort options and can never get it to work... IM completely lost.

Could someone show me how I would do this?
__________________
My Rig
Intel Pentium 4, 2866MHz
1gb RAM
Asus P4C800 Deluxe
eVGA GeForce 6800GS 256mb
420w Power supply(Name escapes me)


I used to be 'with it', then they changed
what 'it' was. Now what I'm 'with' isn't 'it',
and what's 'it' seems weird and scary to me
-.-Jone of the TSG Forums
bkdc's Avatar
Senior Member with 508 posts.
 
Join Date: Apr 2003
Location: Tampa, Flordia USA
Experience: Advanced Dummy
07-Mar-2008, 08:53 PM #2
I used the following command to get the results below.
$ sort -r +2 test.txt
I think this is the right result ????

William Donald 960WaydrColoradoSpringsCO80920 DesertCamoBPProd77778 719-689-9980
Sven Ericsson 2953BeitstolenBeitstolenNorway BlackBPProd77721 +47-61-35-30-00
Diego Torres 2360SanteFeBuenosAiresArgentina BlackRedBPProd77722 +54-4000-6800
Mary Whitmore 1001StatonlnColoradoSpringsCO80920 BabyBlueBPProd77765 719-456-5000
__________________
RLU - 461216

If you talk, you repeat what you already know. If you listen, you learn.
lotuseclat79's Avatar
Distinguished Member with 10,463 posts.
 
Join Date: Sep 2003
Location: -71.45091, 42.27841
08-Mar-2008, 10:40 AM #3
Using the file test.txt containing your data on Ubuntu 7.10 Gutsy Gibbon:

$ cat test.txt | sort -k2
will print out:
William Donald 960WaydrColoradoSpringsCO80920 DesertCamoBPProd77778 719-689-9980
Sven Ericsson 2953BeitstolenBeitstolenNorway BlackBPProd77721 +47-61-35-30-00
Diego Torres 2360SanteFeBuenosAiresArgentina BlackRedBPProd77722 +54-4000-6800
Mary Whitmore 1001StatonlnColoradoSpringsCO80920 BabyBlueBPProd77765 719-456-5000

-- Tom
__________________
The independence created by philosophical insight is - in my opinion - the mark of distinction between a mere artisan or specialist and a real seeker after truth. - Einstein wrote in 1944.

Some say knowledge is power, I say knowledge without action is powerless. - lotuseclat79

Don't confuse action with movement. - Hemingway to Gardner

Imagination is more important than knowledge. - Einstein
Closed Thread

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who help people like you solve computer problems. See our Welcome Guide to get started.



Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 03:27 AM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.