Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error mesg 2042 files can be open at one time 1

Status
Not open for further replies.

frangac

Technical User
Feb 8, 2004
163
ZA
Hi All,

What will be the best way to solve this problem, as stipulated below (max 2042 files).

awk: Cannot open file /dm/tool//TimePrint 2004/05/21 03:07:41 | grep Local | cut -f3 -d" " .
A maximum of 2042 files can be open at one time.
The input line number is 2043. The file is 21-MAY-04Chris


My script

if [[ ! -f $file ]];then
echo "No file to process"
fi

awk -F " " '{
split($1,a,".")
S=a[1]
type=a[2]
D=a[3]
T=a[4]
D_T=$5" "$6
VOL="/trans/Arch_logs/"$3".txt"
cmd="/dm/tool//TimePrint " D_T " | grep Local " "| cut -f3 -d\" \" "
cmd | getline TIME; close(cmd);
printf "bmed %s %s %s %s \" \" %s Arch Arch %s %s Arch %s Success \" \" /raw/arch/\n",T,S,type,D,$1,Date,TIME,$3 > $1
system("/usr/bin/chmod 777 " $1)
{if (system("./"$1 ">>" VOL) != 0) {
system("/dm/tool/.send_alarm " "f + "$1" \" \" 15002 9 \""$1" not updated in Arch\" ")
printf("Failed!!! %s\n",$1);
} else {
system("/sbin/rm " $1)
printf("Done. %s\n",$1)}}
}' $file
 
Have you tried to add a [tt]close($1)[/tt] instruction between the printf "bmed... and the system("... ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Hi PHV,

Thanks for responding.

I tried the following and works

printf "bmed %s %s %s %s \" \" %s Arch Arch %s %s Arch %s Success \" \" /raw/arch/\n",T,S,type,D,$1,Date,TIME,$3 > $1
close($1)
system("/usr/bin/chmod 777 " $1)

Is the above line correct?

Thanks
Chris
 
Is the above line correct?
Yes, it's my suggestion.
Is your problem solved ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Hi PHV,

Yes, it does work.

Could you please explain as to why a close instruction was needed.

Once Again Thanks
Chris
 
Because the printf "..." > $1 open a new file for each distinct value of $1

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top