Redirecting tmp files of SORT into different directory


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Redirecting tmp files of SORT into different directory
# 1  
Old 10-21-2012
Error Redirecting tmp files of SORT into different directory

Hey Guys,
I am facing an annoying scenario, fewer times when I execute the sort command, it throws out on error saying that "No Space on available on /var/tmp/<temp file name>. May be it is set to /var/tmp directory. I was wondering, if I cant redirect the temporary file creation to any other directory. I came across this "-T" option, but was not sure about it.

Could someone help me this, its urgent.
An example could be of great help.

Thanks,
Abhishek S.
# 2  
Old 10-21-2012
Usually sort responds to the TMPDIR environment variable.

Code:
export TMPDIR=/tmp
# or maybe your home directory
export TMPDIR=/home/abishek
#  sort will now use it
sort bigfile > newfile

Once set TMPDIR carries on for the login session
Code:
sort -T=/home/abhishek  bigfile >newbigfilw

This uses the new temporary directory -T indicates, but it just works for that one sort.

Your real problem is very probably that users have littered the /var/tmp directory with junk that was never removed.
This User Gave Thanks to jim mcnamara For This Post:
# 3  
Old 10-21-2012
Can you please post your code?
# 4  
Old 10-21-2012
Hello Jim,
Thanks a lot, I was unaware of the fact that, sort would depend on the TMPDIR variable. Anyway I ll try that immediately and let you know. I think it should work now.

Well, the file I am working with has around 33 mil lines.. so thats where the problem is.. I think it should work fine with the command you have given.

Thanks a lot for your time, I appreciate it.

Abhishek S.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to sort files in directory numerically?

Trying to sort a bunch of files numerically but can't seem to get the command just right. This is in a IBM AIX machine. I have a directory that has... backup.bk1 backup.bk100 backup.bk2 backup.bk200 backup.bk3 backup.bk300 There are a lot more files but this is shortened for the... (5 Replies)
Discussion started by: c3rb3rus
5 Replies

2. UNIX for Beginners Questions & Answers

How do I custom sort the files in a directory using the filenames in a text file.?

Hi all, (5 Replies)
Discussion started by: KMusunuru
5 Replies

3. Shell Programming and Scripting

Shell script to find the GB files in /tmp directory in remote server

Hi, i need help on shell scripting. Main intention of the script is step 1: ssh to remote server Step 2: cd /tmp in remote server Step 3: in tmp i want to grep only files and directories which are in GB sizes All the servers list file is - tmpsrv.txt vi tmpsrv.txt ... (17 Replies)
Discussion started by: kumar85shiv
17 Replies

4. UNIX for Dummies Questions & Answers

using gsed with cp to sort files in directory - every N file copy to new place

Hi all, I'm having a problem with some basic piping issues... I have been able to get in a directory and ls | gsed in order to list every N file for instance: ls | gsed -n '2~5p' The thing is I want to be able to copy the output files to a new directory. Basically directory /all has a... (4 Replies)
Discussion started by: dgoss
4 Replies

5. Shell Programming and Scripting

Need script to remove millions of tmp files in /html/cache/ directory

Hello, I just saw that on my vps (centOS) my oscommerce with a seo script has created millions of tmp files inside the /html/cache/ directory. I would need to remove all those files (millions), I tried via shell but the vps loads goes to very high and it hangs, is there some way to do a... (7 Replies)
Discussion started by: andymc1
7 Replies

6. UNIX for Dummies Questions & Answers

Shell script which will sort all the files in a directory with the timestamp they were created

Team, Pls help writing a shell script which will sort all the files in a directory with the timestamp they were created. (like ls -lrt) (6 Replies)
Discussion started by: asappidi
6 Replies

7. Shell Programming and Scripting

How to sort a set of files by date in a directory?

hi there, I have a directory which contents I can parse dynamically. I end up with a file list. I then want to display those files sorted by date, oldest files first. I have very very little PERL experience...Would anyone know how to do that ? Thanks in advance. (8 Replies)
Discussion started by: alexf
8 Replies

8. UNIX for Dummies Questions & Answers

Sort all files in a directory retaining originals

Hi, I need to sort all the files in a directory whilst retaining the originals. So if in the directory I have: File1 File2 File3 I want to sort these files so that I would have: File1 File1.sort File2 File2.sort File3 File3.sort where I have added the .sort extension to show... (4 Replies)
Discussion started by: ledgie
4 Replies

9. AIX

loop through the directory for files and sort by date and process the first file

hello i have a requirement where i have a direcotry in which i get files in the format STOCKS.20080114.dat STOCKS.20080115.dat STOCKS.20080117.dat STOCKS.20080118.dat i need to loop through the directory and sort by create date descending order and i need to process the first file. ... (1 Reply)
Discussion started by: dsdev_123
1 Replies

10. Red Hat

/tmp directory

i heard once that the /tmp directory was a ramfs (swap) that is cleared at reboot time, is this still the case in redhat EL 3 and 4 ? (1 Reply)
Discussion started by: BG_JrAdmin
1 Replies
Login or Register to Ask a Question