sort can't stat error.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting sort can't stat error.
# 1  
Old 06-02-2005
sort can't stat error.

I am using the command below to sort unique a file and I keep getting this error that sort can't stat.
Error:
sort: can't stat /xxxx/xxxxx/2005/xxxxxx/out_20050602155231/test.txt: No such file or directory

Does anybody have an idea when this error could occur.

Thanks,
Radhika.

if [ ${outfile} = "test.txt" ]
then

#The following command creates the outfile in the outputdirectory.
{SCRIPTSD}/perf_mast.sh ${INPUTD} ${OUTPUTD} ${SCRIPTS} ${filename} ${dm} ${dte}
wait

Command:
#Remove duplicates in the output file and the sorted file name is sort_outfilename
sort -u ${OUTPUTD}/${outfile} > ${OUTPUTD}/sort_${outfile}
wait
# 2  
Old 06-02-2005
make sure you have read permission on the you're trying to sort
# 3  
Old 06-02-2005
Either the file, or in this case more probably the directory you are using in you script doesn't exist.
# 4  
Old 06-02-2005
I am thinking the problem is I am creating the directory on the fly and then the output file on the fly. And I tried to give the read permission on the fly. and then tried sort. It gave me warning: can't access file. Some thing is wrong.

When you are doing sort do we have to be in the directory where the output file exists.

Or can I just give the path to that output file in the sort command?

I have to go pick up my son from daycare and then I will try it again from home!
# 5  
Old 06-02-2005
Quote:
Originally Posted by radhika
I am thinking the problem is I am creating the directory on the fly and then the output file on the fly. And I tried to give the read permission on the fly. and then tried sort. It gave me warning: can't access file. Some thing is wrong.

When you are doing sort do we have to be in the directory where the output file exists.

Or can I just give the path to that output file in the sort command?

I have to go pick up my son from daycare and then I will try it again from home!
You can give the path to the file, provided that both the directory and file exist. Really it would be much easier to help if you posted your script. Usually it would not be required to change the permissions on the directory, as it is unusual to use a umask which does not allow the creator to read.
# 6  
Old 06-03-2005
I figured out my problem!!!

I really couldn't have posted the script - it was long and one was calling another too many arguments etc...

Anyway, this is how my code is layed out...

#Main Shell....Script......
doing some processing.....then calls the sub shell script.
First_sub_shell.sh $1 $2 ...
depending on which file and the logic it in turn calls another sub shell script.
Second_sub_shell.sh $1 $2 ....
#Then comes the sort command in the first_sub_shell.
sort -u text.txt > sorted_text.txt

Second_sub-shell script $1 $2.... actually opens a sqlplus session and executes a .sql file to spool data into a text file. Problem was first sub-shell was trying to sort the output text file created in second sub-shell. ONLY, the sql hasn't completed spooling all the data into the text file. I think that's why it couldn't see the text file.

Once I put the wait command in the second sub-shell after the sqlplus call everything works nicely. My sort command is just fine.

I hope you understood-
Thanks for trying.
Radhika.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

/bin/find: stat() error <File> : No such file or directory

Hi, I am getting below error in Solaris 10 SPARC when trying to issue a search on /var/tmp partition Below is the query /bin/find /var/tmp/ -type f -atime +1 Below is the result /bin/find: stat() error <File> : No such file or directory (28 Replies)
Discussion started by: prash358
28 Replies

2. Shell Programming and Scripting

Intermittent "cp: cannot stat" error with nested loop

I have a bash script that has been running (on SUSE 9.3) dozens of times over the past couple of years without error. Recently it has been hitting intermittent “cp: cannot stat FILE: No such file or directory” errors. The script has nested loops that continuously process files in a... (2 Replies)
Discussion started by: jcart
2 Replies

3. Shell Programming and Scripting

Ignoring mv commands "cannot stat" error ?

So, my third thread here ^^ and still asking questions. Thanks for you patience and help, I really appreciated it ;) I currently use a shell script to move folders of songs from one to another location on my harddrive. I use something like this: sudo mv /var/mobile/Media/"My Music"/"Vasco... (3 Replies)
Discussion started by: pasc
3 Replies

4. Programming

Error in bits/stat.h

i have a piece of code to be compiled but unfortunately i keep getting the below error /usr/include/bits/stat.h:88: error: field ‘st_atim' has incomplete type /usr/include/bits/stat.h:89: error: field ‘st_mtim' has incomplete type /usr/include/bits/stat.h:90: error: field ‘st_ctim' has... (1 Reply)
Discussion started by: niranjanvg
1 Replies

5. Shell Programming and Scripting

cannot stat error

I'm trying to find .tif files in a directory tree and rename them prior to zipping them and moving them to another dir. this is my code: cd $TMPPATH pwd ctr=0 for i in 'find . -name "*.tif"' do let "ctr+=1" newtifname=$DATEDIR"_"$SEQ"_"$ctr".tif" mv "$i"... (6 Replies)
Discussion started by: rss0213
6 Replies

6. Solaris

How to resolve error "INIT: Cannot stat /etc/inittab, errno: 2"

Hi All, I am getting an error message when I execute command “zlogin -C sunsrv4z5” on my root server. INIT: Cannot stat /etc/inittab, errno: 2 INIT: Cannot stat /etc/inittab, errno: 2 As per my analysis it seems that some files inside /etc folder are deleted. This server was... (14 Replies)
Discussion started by: surbhit4u
14 Replies

7. Homework & Coursework Questions

Making a sort error

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: I need to show when stderror would be written to save1 and when it would be written to save2 2. Relevant... (0 Replies)
Discussion started by: snag49ers
0 Replies

8. UNIX for Dummies Questions & Answers

what is a "find stat() error"

I'm searching for an oracle emtab file. I do a find / -name emtab -print and the first result gives me find: stat() error /apps/tomcat/jakarta-tomcat-5.5.9/bin/console.txt: I/O error Can someone explain what this error means? thanks, (2 Replies)
Discussion started by: orahi001
2 Replies

9. UNIX for Advanced & Expert Users

Cannot Stat Error

I'm not sure where to post this so I'll try it here. I'm trying to load a software package to my server and I keep getting a cannot stat error. I'll post the error line below along with my configuartaion line. Can anyone help or point me in the right direction. Thanks! This is the error. ... (1 Reply)
Discussion started by: Homer Allman
1 Replies

10. Shell Programming and Scripting

sort unexpected error?

I have the following script: mysort.sh: #!/bin/ksh for i in `ls` sort -bfu $i > sort_$i wait mv sort_$i $i wait done exit 0 I get the following error: mysort.sh: syntax error at line 3 : `sort' unexpected Does anybody know what I am missing here. ... (2 Replies)
Discussion started by: radhika
2 Replies
Login or Register to Ask a Question