Sort command using which directory


 
Thread Tools Search this Thread
Operating Systems HP-UX Sort command using which directory
# 1  
Old 03-02-2012
Sort command using which directory

Hi,

One of our script is executing following "sort" command.

/bin/sort $delimiter $key $originalFile -o $newFile

and while executing this, we are getting the following error:

sort: A write error occurred while merging.

While reading about this I come to know this is because of insufficient size in TMP directory, but as I am not a unix guy, I don't know which TMP directory "sort" is using and what is the maximum size allocated to that directory. Smilie

Please help me for the same.

Thanks,
Manu

Moderator's Comments:
Mod Comment Please use next time
code tags for your code and data

Last edited by vbe; 03-02-2012 at 12:02 PM..
# 2  
Old 03-02-2012
On an HP system there is big chance (99% ? ) it be /tmp...
You did not say OS version platform nor size of files you are trying to merge...
# 3  
Old 03-02-2012
1.25 GB of file having 13,500,000 lines.
Unix version: HP-UX B.11.23

Regards,
Manu
# 4  
Old 03-02-2012
It will be /var/tmp by default unless you have $TMPDIR set.
See man sort and the "-T" parameter regarding how to change it. You could need three times the size of the original file for work space.

Use the bdf command to find out where you have some free space.
This User Gave Thanks to methyl For This Post:
# 5  
Old 03-02-2012
I executed echo $TMPDIR

I didn't see any result. What it mean? that default temp directory (/var/tmp or /tmp) is being used.

Can you tell me how to set this parameter to use some other directory as temporary directory.

Thanks.

---------- Post updated at 11:53 PM ---------- Previous update was at 11:47 PM ----------

Is export TMPDIR=/tmpdump the correct way to set this environment variable?
# 6  
Old 03-02-2012
If you see no result, that means its not set, yes.

That will work on some systems but not others. The proper way to do it, the way which works everywhere, would be:

Code:
TMPDIR=/tmpdump
export TMPDIR

# 7  
Old 03-03-2012
Yes, if $TMPDIR is not set the "sort" command will use "/var/tmp" then "/tmp".
Quote:
export TMPDIR=/tmpdump
Will work on HP-UX in "sh" (i.e. the default for the "root" account) or "ksh".
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

Sort by file/directory size

OS : RHEL 6.6 I want to list the files/directories sorted (Ascending or Desceding) by their size. As you can see in the below example, du command doesn't sort by size. In Linux world, is there any other command or workaround using du command to list the files/directories sorted by their... (6 Replies)
Discussion started by: John K
6 Replies

3. UNIX for Dummies Questions & Answers

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... (3 Replies)
Discussion started by: abhisheksunkari
3 Replies

4. Shell Programming and Scripting

Is it Possible to sort a list of hexadecimal numbers using "sort" command?

Hello Everybody :) !!!. i have question in mind, is it possible to sort a list of hexadecimal numbers using "sort" command? (9 Replies)
Discussion started by: Kesavan
9 Replies

5. Shell Programming and Scripting

How to Sort Floating Numbers Using the Sort Command?

Hi to all. I'm trying to sort this with the Unix command sort. user1:12345678:3.5:2.5:8:1:2:3 user2:12345679:4.5:3.5:8:1:3:2 user3:12345687:5.5:2.5:6:1:3:2 user4:12345670:5.5:2.5:5:3:2:1 user5:12345671:2.5:5.5:7:2:3:1 I need to get this: user3:12345687:5.5:2.5:6:1:3:2... (7 Replies)
Discussion started by: daniel.gbaena
7 Replies

6. UNIX for Dummies Questions & Answers

Sort by size, then list file in each directory

Hi, I have directories with name like: aaa bbb ccc ... I would like to to see which directories are the largest and then list the files within each. I have success using: du -ks * | sort -rin | head -n 20 which gives me an output like: 120 bbb 27 ccc 3 aaa ... I would like... (3 Replies)
Discussion started by: ChatPerdu
3 Replies

7. UNIX for Dummies Questions & Answers

How can I sort the file names in the directory

Hi , I have a list of files in the directory I want to sort based on the file name. But in the middle of filename contains the number based on that I need to sort.Could you suggest me on the same? Example filenames: /user1$ls RS.DEV.ISV.F1.RS.REFDATA.DATA... (1 Reply)
Discussion started by: praveen.thumati
1 Replies

8. 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

9. 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

10. Shell Programming and Scripting

How to sort directory names and use only last?

I need help writing a bash script for the windows cygwin environment. I'm not sure if bash is the optimal tool. Perhaps perl would be better? Either would work. I have directories whose names include the date they were created. The directory names are in the format of... (0 Replies)
Discussion started by: siegfried
0 Replies
Login or Register to Ask a Question