hi all
i'm really to this forum stuff and to scripting also...
my problem is when i'm using a foreach loop in csh a error is coming "too many words from " .....
this error comes when i run the loop more then 1800 times i think coz when i run it for less then 1800 or so it runs fine....
can anyone help me in that....
thanks in advance
:rolleyes:
Welcome to the forums. It would certainly help if you showed us the script. man csh says
LIMITATIONS
Words can be no longer than 1024 characters.
The system limits argument lists to 10240 characters.
The number of arguments to a command which involves filename expansion
is limited to 1/6th the number of characters allowed in an argument
list.
Command substitutions may substitute no more characters than are allowed
in an argument list.
To detect looping, the shell restricts the number of alias substitutions
on a single line to 20.
Also, see this link - 1992: SUMMARY: How many is too many words to csh?
If you will help us !! We help you
Can you provide some more info with example and code as well
thanks for your reply !
foreach k (`cat /home/priyank/try_2/data3/date.txt`)# in this loop i'm opening a file which has 2000 dates in a coloun one by one and this shows hat error...
echo "$k" | awk -F'-' '{print $3"/"$1"/"$2}' >> /home/priyank/try_2/data3/cool.txt
end
thanks
but i have checked this link but i could not get anything
thanks vivo
yes i have checked this link but i couldn't get anything please help....
Please read and understand what the man page says.
The man page description says the system limits argument list to 10240 characters. You say you have 2000 entries and assuming each date entry is of the form xx-xx-xx i.e. 8 characters, the argument list computes to atleast 2000 * 8 + 1999 * 1 (whitespace) characters. If my assumptions and calculations are right, then that number is way above 10240.
Anyways, why a for loop when awk alone can do it ? I think this should work as well.
awk -F'-' '{print $3"/"$1"/"$2}' /home/priyank/try_2/data3/date.txt >> /home/priyank/try_2/data3/cool.txt
I hope this is no homework question.
thanks for your help
one more question can you please tell me how can i use this (the one you told me) or any other awk statement like "set y = `echo 2007/01/31 $p | awk '{print($2<=$1)}'`" in perl
please someone help me in running awk statement in perl !!!