LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 06-27-2011, 02:49 PM   #1
juliamarie
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, 02:56 PM   #2
anomie
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.

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


Reply


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 02:15 PM
Sorting Rows of a file iframe Linux - Software 16 05-28-2009 05:38 AM
How do you assign a variable to be a variable file name in a directory? David_Elliott Programming 4 04-14-2009 11:19 AM
Help with sorting a file Yogiz Linux - Newbie 5 12-08-2007 05:41 PM
Linux File Sorting linuxgodrh Linux - General 7 08-01-2007 10:33 AM


All times are GMT -5. The time now is 03:11 AM.

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