Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 06-27-2011, 01:49 PM   #1
LQ Newbie
Registered: Jun 2011
Posts: 1

Rep: Reputation: Disabled
Sorting a file with a variable name

I am trying to sort a file, so I can compare it to another file later.
I am storing the file name in a variable called curMo.
I then call sort $curMo and it hangs for a very long time and I have to quit the process.
Any idea why this is not working or how to make it work?
Here is part of my code:

#sort this file for this Location
sort -u $curMo -o $curMo.sorted

Thank you!
Old 06-27-2011, 01:56 PM   #2
Senior Member
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
Read the manpages for sort(1). You have the right idea, but are invoking it incorrectly.

$ sort -u -o ${foo}.sorted ${foo}
1 members found this post helpful.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to get variable from text file into Bash variable mcdef Linux - Software 2 06-10-2009 01:15 PM
Sorting Rows of a file iframe Linux - Software 16 05-28-2009 04:38 AM
How do you assign a variable to be a variable file name in a directory? David_Elliott Programming 4 04-14-2009 10:19 AM
Help with sorting a file Yogiz Linux - Newbie 5 12-08-2007 04:41 PM
Linux File Sorting linuxgodrh Linux - General 7 08-01-2007 09:33 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:12 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration