Awk limitations in AIX 5.2 - 399 byte limit!


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Awk limitations in AIX 5.2 - 399 byte limit!
# 1  
Old 05-28-2009
Awk limitations in AIX 5.2 - 399 byte limit!

AIX version 5.2 has an arbitrary limit of 399 on the length of regular expressions and literal strings in an Awk program.

Apart from splitting down the string into multiple strings is there any way around this annoyance?

I have a search string that ends up way way too long and blows out awk!
awk: 0602-508 The string or regular expression beginning with
the characters "^.*[.]DLC$" cannot contain more than 399 bytes. The source line is 1.
The error context is
>>> .]DEL$|^.*[.]ONU[.]DEL$|^.*[.]OSU[.]DEL$|^.*[.]ORJ[.]DEL$|^.*[.]RNJ[.]DEL$|^.*[.]RNU[.]DEL$|^.*[.]RNA[.]DEL$| <<< ^.*[.]RRJ[.]DEL$|^.*[.]ONJ[.]DEL$|^.*[.]OBT[.]DEL$|^.*[.]AWH[.]DEL$|^.*[.]AWI[.]DEL$|^.*[.]MAJ[.]DEL$|^.*[.]MAV[.]DEL$|^.*[.]MDA[.]DEL$|^.*[.]MDC[.]DEL$|^.*[.]MDN[.]DEL$|^.*[.]MFC[.]DEL$|^.*[.]MFN[.]DEL$|^.*[.]MFV[.]DEL$|^.*[.]RSU[.]DEL$|^.*ERR.*$|^.*[.]DRD[.]DEL$/){print $NF}}
Syntax Error The source line is 1.
awk: 0602-502 The statement cannot be correctly parsed. The source line is 1.

Any advice would be much appreciated.

Last edited by Peejay; 05-28-2009 at 12:25 PM..
# 2  
Old 05-28-2009
I know of no way to come around this limitation - BUT:

do you really think that what you have pasted constitutes professionally crafted code? Honestly, ask yourself: if i look in one year from now onto this code, would i be able to know what i have done? Now suppose someone else is maintaining this code, he would not even have the advantage of being you and knowing how you usually do things - he will be lost completely.

Do yourself (and any possible maintainer) a favor and rewrite it. Take the awk limitation not as a nuisance but as a chance.

Copy your script here and some example input file and desired output and we can help you write better code.

I hope this helps.

bakunin

PS: coming to think about it please post it to the "shell scripting and programming" part of the forum because this would be not in the scope of the AIX board any more.
# 3  
Old 05-28-2009
The string is built up by grabbing a list of search values from config files, that's certainly not hardcoded, I'd need to be shot if it was Smilie

FILEs="`get_configs | grep -v "^#" | grep ",$APP_NAME," | awk -F, {'print $3'} | tr '\n' '|' | sed 's/\./[.]/g; s/*/.*/g; s/?/./g; s/|$//; s/^/^/; s/|/$|\^/g' `$"

for FILE in `awk '{if ($NF~/'${FILES}'/){print $NF}}' $temp_dir_file`
do
.....
done

This builds up the list of values for the specific APP_NAME, unfortunately the one in question has reams of bloody entries for it!

Last edited by Peejay; 05-28-2009 at 12:36 PM..
# 4  
Old 05-28-2009
something along these lines..
Code:
nawk -v pats='^.*[.]ONU[.]DEL$|^.*[.]OSU[.]DEL$' '
   BEGIN {
      n= split(pats, patsA, "|")
   }
   {
      for(i=1; i<=n; i++)
         if ($0 ~ patsA[i]) {
            print $NF
            next
         }
   }
' myFile

# 5  
Old 05-28-2009
Quote:
Originally Posted by bakunin
PS: coming to think about it please post it to the "shell scripting and programming" part of the forum because this would be not in the scope of the AIX board any more.
You're right, sorry about that. Could a mod move the thread to the correct forum for me and rename it to "Awk limitations - 399 byte limit" so as to avoid cross posting please.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. AIX

Limit directory Size in AIX

Hello I have a disk mounted on my AIX server and inside the disk, I want to create 3 directories with max size limit, so that the directories can be limited to pre-defined size. Eg: My total disk size is 350 GB and I want to limit dir1 to max of 100 GB, dir 2 to 75 GB and dir 3 to 60 GB and... (3 Replies)
Discussion started by: karumudi7
3 Replies

2. UNIX for Advanced & Expert Users

Help with AIX port limit

Hi guys, I have a problem need to solve urgently, please help me, any suggestion will be great. When my workmates installed a control-m agent in an AIX 6.1 OS, they got an error below: Port exceeded maximum allowed value. No available port found in the specified range up to 65535. ... (2 Replies)
Discussion started by: Lucas_0418
2 Replies

3. AIX

Limit a user on AIX

Hello, Sorry for my poor English. I have to reduce rights for a user on AIX system so that: When he does , he find in output, only filesystems on which he has permissions .He can't do to change user. Very thanks for helping. (2 Replies)
Discussion started by: edosseh
2 Replies

4. Shell Programming and Scripting

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: { if (NF==17){ print $0 }else{ fields=NF; all=$0; while... (2 Replies)
Discussion started by: fate
2 Replies

5. Shell Programming and Scripting

Remove a byte(Last byte from the last line)

Hi All Can anyone please suggest me how to remove the last byte from a falt file .This is from the last line's last BYTE. Please suggest me something. Thank's and regards Vinay (1 Reply)
Discussion started by: vinayrao
1 Replies

6. Shell Programming and Scripting

Check if 2 files are identical byte-to-byte?

In my server migration requirement, I need to compare if one file on old server is exactly the same as the corresponding file on the new server. For diff and comm, the inputs need to be sorted. But I do not want to disturb the content of the file and need to find byte-to-byte match. Please... (4 Replies)
Discussion started by: krishmaths
4 Replies

7. AIX

How to display IPC limit on AIX?

Such as how to display these: number of message queue IDs : 4,096 bytes per message : 8,192 bytes per message queue : 65,536 messages per message queue : 8,192 (4 Replies)
Discussion started by: rainbow_bean
4 Replies

8. AIX

Is the Length of User ID for AIX Limit to 8 Characters?

Hi, I'm using AIX version 5.3 currently. I'm trying to create a user id, e.g. andyleong, which the system prompted the length is too long. 1. I would like to know is that the length of user id is limited to maximum 8 characters for AIX. 2. Is it apply to all versions of AIX? If no... (2 Replies)
Discussion started by: meihua_t
2 Replies

9. Shell Programming and Scripting

substr() limitations in "AWK" program..!!!

Is there any limitation for the function substr() Iam trying to assign some 11 digit number value to variable. And printing the variable. This is printing invalid values. cur_val=substr($0,36,11); printf "Current Value is: %d\n",cur_val I tried till 9 digits length, it was working fine. If... (6 Replies)
Discussion started by: lokiman
6 Replies

10. Shell Programming and Scripting

Limitations of awk? Good idea? Bad idea?

Keeping in mind that I'm relatively comfortable with programming in general but very new to unix and korn/bourne shell scripts.. I'm using awk on a CSV file, and then performing calculations and operations on specific fields within specific records. The CSV file I'm working with has about 600... (2 Replies)
Discussion started by: yongho
2 Replies
Login or Register to Ask a Question