ksh script throwing arg list too long for mv cp wc - everything
i have a ksh script which internally calls another ksh script.
this inner script has simple commands like shown in the code window.
In the script im trying to do a mv - it fails with arg list too long.
then i try to perform cp and cat - and both are failing with similar error.
How is it possible that while trying to move only one file to a different file name - shell is throwing arg list too long error?
Please note - when i run the same command from command prompt it works just fine.
Please suggest/help if someone has seen such a problem before.
thanks.
The above script fails with this errors:
HTML Code:
Setting outtempfile name.
outtempfile=[/work/users........log/VALIDFILELIST_21798_20121108_073435.log_tmp]
/work/users......../script_Sh[22]: /usr/xpg4/bin/rm: arg list too long
/work/users......../script_Sh[25]: /usr/bin/which: arg list too long
move command :
[[[ mv /work/users........log/VALIDFILELIST_21798_20121108_073435.log /work/users........log/VALIDFILELIST_21798_20121108_073435.log_tmp ]]]
/work/users......../script_Sh[30]: /usr/xpg4/bin/mv: arg list too long
[WARNING] mv command failed. Source file: [/work/users........log/VALIDFILELIST_21798_20121108_073435.log], Destination file: [/work/users........log/VALIDFILELIST
_21798_20121108_073435.log_tmp]
Copying content from /work/users........log/VALIDFILELIST_21798_20121108_073435.log to /work/users........log/VALIDFILELIST_21798_20121108_073435.log_tmp
/work/users......../script_Sh[37]: /usr/xpg4/bin/cp: arg list too long
[INFO] perform change dir
/work/users........log
/work/users......../script_Sh[47]: /usr/xpg4/bin/basename: arg list too long
moving to _tmp
/work/users......../script_Sh[50]: /usr/xpg4/bin/mv: arg list too long
[ERROR] Failed to copy content from /work/users........log/VALIDFILELIST_21798_20121108_073435.log to /work/users........log/VALIDFILELIST_21798_20121108_073435.lo
g_tmp
validateScript /work/users......../script_Sh returned failure.
Suggestion: Put all your string arguments for your commands in double quotes and retry
E.g:-
Quotes are not helping.
Same situation.
HTML Code:
Setting outtempfile name.
outtempfile=[/work/users/......../log/VALIDFILELIST_7309_20121109_055054.log_tmp]
/work/users/......../script_Sh[22]: /usr/xpg4/bin/rm: arg list too long
/work/users/......../script_Sh[25]: /usr/bin/which: arg list too long
move command :
[[[ mv /work/users/......../log/VALIDFILELIST_7309_20121109_055054.log /work/users/......../log/VALIDFILELIST_7309_20121109_055054.log_tmp ]]]
/work/users/......../script_Sh[30]: /usr/xpg4/bin/mv: arg list too long
[WARNING] mv command failed. Source file: [/work/users/......../log/VALIDFILELIST_7309_20121109_055054.log], Destination file: [/work/users/......../log/VALIDFILELIST_
7309_20121109_055054.log_tmp]
Copying content from /work/users/......../log/VALIDFILELIST_7309_20121109_055054.log to /work/users/......../log/VALIDFILELIST_7309_20121109_055054.log_tmp
/work/users/......../script_Sh[37]: /usr/xpg4/bin/cp: arg list too long
[INFO] perform change dir
/work/users/......../log
/work/users/......../script_Sh[47]: /usr/xpg4/bin/basename: arg list too long
moving to _tmp
/work/users/......../script_Sh[50]: /usr/xpg4/bin/mv: arg list too long
[ERROR] Failed to copy content from /work/users/......../log/VALIDFILELIST_7309_20121109_055054.log to /work/users/......../log/VALIDFILELIST_7309_20121109_055054.log_tmp
OUTVALIDLIST - contains the name of the file which is passed to this script. This file exists before the script is called. (empty file)
Data is populated in the file by the failing script.
When i check on file system - file exists and has proper ascii text data as i expect.
Problem occurs - when i say wc -l ${OUTVALIDLIST}
and so on as shown in code snippet earlier.
---------- Post updated at 07:34 AM ---------- Previous update was at 05:39 AM ----------
Quote:
Originally Posted by alister
Which operating system and version is this failing on?
Hello All,
I am trying to find a file name with .sh exention from a list of .dat files inside a directory.
find /app/folder1/* -name '*.dat'| xargs grep '.sh'
ksh: /usr/local/bin/find: arg list too long
Please help me finding the command.
Thanks (3 Replies)
Hi,
Help. I have a file that contains a list of users in a file. I want to cat the content of the file and feed it into sed to a preformated report. The error I got is "ksh: /usr/bin/sed: arg list too long" My method below.
A=`cat FILE1.txt`
B=`echo $A`
sed "s#USERLIST#$B#" FILE2 >... (2 Replies)
Hey guys. I have a program written in which i am trying to get the files from one remote machine and transferring the files to another remote machine using SCP.
It works fine for 50 or 60 files but when the files grows to 250 then i get an error message stating "Arg list too long".
#scp -p... (5 Replies)
I am using IBM AIX unix version 4.3.3.0.
In a directory there are many files with different patterns.
When I am trying to execute the command, ls -l with the file pattern, which have fewer files it gives the desired result. However when I am trying to execute the same command for file pattern,... (2 Replies)
when i run the command below in a directory which contains too
many files i got the error: ksh: /bin/grep: arg list too long
ls|grep AA*B*
how can i handle this problem? (5 Replies)
echo dirname/filename* | xargs ls -t
As a substitute doesn't give the results desired when I exceed the buffer size. I still want the files listed in chronological order, unfortunately xargs releases the names piecemeal...does anyone have any ideas? :( (4 Replies)
Hi all
I have more than 1000 files in a folder and when ever i use a "compress" or "zcat" command it give error
/bin/zcat: Arg list too long. .
any solution for this :o (3 Replies)
hi everyone,
We have a heck of a lot of files in a particular directory and I need to search through all of them to find a list of all files containing particular text strings...one being a date and the other being the name of the report that is printed on the files.....
I've tried the... (6 Replies)
I do ls -l ABC*, I get arg list too long message. This will not happen if ABC* has small no of files I believe 4000 files is limit. Any way of avoiding this.
I even tried like this
for i in `ls -l ABC*`
do
echo $i
done
Same problem.
Any solution would be great.
I am on HP-UX... (5 Replies)