Problem with awk awk: program limit exceeded: sprintf buffer size=1020


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Problem with awk awk: program limit exceeded: sprintf buffer size=1020
# 1  
Old 04-20-2010
Problem with awk awk: program limit exceeded: sprintf buffer size=1020

Hi

I have many problems with a script. I have a script that formats a text file but always prints the same error when i try to execute it

The code is that:

Code:
{
      if (NF==17){
            print $0
      }else{
            fields=NF;
            all=$0;
            while (fields<17){
                  getline;
                  todo=sprintf("%s %s",all,$0);
                  campos=fields + NF;
                  fields=campos;
                  all=todo;
            }
            print all;
      }
}



i execute it:

awk -F '@@@' -f kk.awk productos.TXT
awk: program limit exceeded: sprintf buffer size=1020
FILENAME="productos.TXT" FNR=2 NR=2

How could I make the buffer not to get full?

thanks
# 2  
Old 04-21-2010
Can you plz share with us what exactly are you trying to do. May be we can then help you.
# 3  
Old 04-21-2010
If you only keep in a buffer the data, why not use printf for write directly

Code:
{
      if (NF==17){
            print $0
      }else{
            fields=NF;
            printf("%s", $0)
            while (fields<17){
                  getline;
                  printf("%s", $0)
                  campos=fields + NF;
                  fields=campos;
            }
            printf "\n"
      }
}

But I still don't understand some partes in the script, why do you use fields and campos variables? Is correct to print a line with less than 17 fields and another with exactly 17 fields in the same line?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Using sprintf and system command in awk

Hello Friends, I'm trying something hard (for me) to create a report script,normally the following script works: Echos are just for cosmetic touch, echo -n "\n-----\t----------\t-------------\t\t--------------\t\t--------\n COUNT\tEVENT_TYPE\tRESPONSE_CODE\t\tINTERNAL_ERROR\t\tFLOWNAME... (7 Replies)
Discussion started by: EAGL€
7 Replies

2. UNIX for Dummies Questions & Answers

Join with awk using sprintf

Hi, Trying to join 2 files with awk (file1 has variable number of fields; file 2 has constant number of fields) file1: hook1|AA|BB|CC|DD hook2|EE|FF file2: hook1|11|22 hook2|33|44 hook3|55|66 output: hook1|11|22|AA|BB|CC|DD hook2|33|44|EE|FF hook3|55|66 What I tried so far:... (3 Replies)
Discussion started by: beca123456
3 Replies

3. Red Hat

Postfix keeps returning "Command time limit exceeded" message

We are having issues with our Postfix. The POP and IMAP services randomly stops working an sent e-mails return a "Command time limit exceeded". We've found out that running these command fix the problem: service cyrus-imapd stop rm /var/lib/imap/tls_sessions.db* rm... (2 Replies)
Discussion started by: GustavoAlvarado
2 Replies

4. UNIX for Dummies Questions & Answers

httpd count exceeded threshold limit

Hello Everyone, I am new to this forum and also unix/linux. Our application today threw an alert whcih read as "The users active count on host has crossed the threshold limit of 50 and is standing at 65." This was although cleared when I restarted tomcat. But I am not sure why this count... (0 Replies)
Discussion started by: ykhati
0 Replies

5. Shell Programming and Scripting

awk file size limit

My code is awk '{ out=split(FILENAME,a,"/") sub(/\./,"_",a) sub(/\-/,"_",a) NEWSTRING="main_"a"_"a"(" # The word we want to insert gsub(/main\(/,NEWSTRING); # the word to be replaced print "Main becomes ",NEWSTRING")","in file ",FILENAME >> "/home/ds2/test/NEW2.txt" ... (4 Replies)
Discussion started by: senior_ahmed
4 Replies

6. Shell Programming and Scripting

Logfile Size exceeded ????

Hi, How to write a script which checks the size of a log file? I want that the log file contents to get cleared as soon as it increases 1 KB. Thanks (3 Replies)
Discussion started by: skyineyes
3 Replies

7. UNIX for Dummies Questions & Answers

File size limit exceeded... SCO ulimit?

Hello - O/S is UnixWare 7.1.4 My prefered method of copying files between servers is 'rcp', which does not recognize symbolic links; therefore, files are duplicated many times over. To avoid this duplication, I would like to use 'tar' and/or 'cpio' and pipe them through 'rcp', but... (1 Reply)
Discussion started by: rm -r *
1 Replies

8. Solaris

/tmp: File system full, swap space limit exceeded

Can you help. My server sunning solaris 9 on x86 platform pretty much hung for a few hours... I could not use telnet or ssh to the box - it kept refusing connection. A few hours later - I was able to log in again. The server has not rebooted but here are the first errors in the messages log... (5 Replies)
Discussion started by: frustrated1
5 Replies

9. UNIX for Dummies Questions & Answers

Error, Login Limit Exceeded by 1 user

Would appreciate some help, system was displaying an error regarding the kernal when a "sar" was run, after a reboot we get "WARNING user login limit exceeded by 1 user". We have plenty of licences. any ideas? (1 Reply)
Discussion started by: nchrocc
1 Replies

10. Programming

File size limit exceeded

When i run my C program which dynamically creates the output file, the program stops after sometime and gives the error "File size limit exceeded" even though my working directory has space.Can anyone plz help me out. (13 Replies)
Discussion started by: drshah
13 Replies
Login or Register to Ask a Question