awk: Input line Cannot be longer than 3,000 bytes.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting awk: Input line Cannot be longer than 3,000 bytes.
# 1  
Old 07-17-2011
Tools awk: Input line Cannot be longer than 3,000 bytes.

Guys,

I want to get the high CPU utilization from top.

I am using below code :
Code:
top -d2 >> /home/dba_monitoring/host_top_output.txt
echo "Script started `date`" > $runlog
usage=`grep "^ *$1" /home/dba_monitoring/host_top_output.txt | awk '{print $12}' | sed 's/%//'`

And getting below error message.
Code:
./cpu_consuming_queries.sh
awk: Input line Cannot be longer than 3,000 bytes.
 The input line number is 1.
 The source line number is 1.

Can anyone suggest please.

ThanksSmilie

Last edited by Franklin52; 07-17-2011 at 03:14 PM.. Reason: Please use code tags for data and code samples, thank you
# 2  
Old 07-17-2011
in Solaris, use nawk or /usr/xpg4/bin/awk
# 3  
Old 07-17-2011
You can also roll the bits done by grep and sed commands into your awk script:

Code:
usage=$(nawk -v N="$1" '$0 ~ "^ *"N { sub(/%/, "", $12); print $12 }' /home/dba_monitoring/host_top_output.txt)

# 4  
Old 07-18-2011
Hi

nawk is not working as this is HP-UX.

I am getting below error :

awk: Input line
annot be longer than 3,000 bytes.
The input line number is 1. The file is /home/dba_monitoring/host_top_output.txt.
The source line number is 1.
# 5  
Old 07-18-2011
Do you have gawk, I think it's available on HP-UX 11 and shouldn't have the 3,000 character limit.
# 6  
Old 07-19-2011
top has a -f option that will automatically append output to a user specified logfile...so consider using that instead of >>
# 7  
Old 07-20-2011
Hi,

I tried using gawk but getting below error.

: gawk: not found
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk : Want to print columns of different input files in line wise

Hi, I want to print last column of 3 input files with awk. cat file1.txt file2.txt file3.txt file1.txt 1 ad 200 2 ss 300 file2.txt 1 mm 444 2 ee 555 file3.txt 1 kk 999 2 jj 555 My o/p should be :- 1 200 444 999 2 300 555 555 (3 Replies)
Discussion started by: satishmallidi
3 Replies

2. Shell Programming and Scripting

Read input file with in awk script not through command line

Hi All, Do we know how to read input file within awk script and send output toanother log file. All this needs to be in awk script, not in command line. I am running this awk through crontab. Cat my.awk #!/bin/awk -f function test(var){ some code} { } END { print"test code" } (5 Replies)
Discussion started by: random_thoughts
5 Replies

3. Shell Programming and Scripting

Shell script - entered input(1-40 bytes) needs to be converted exactly 40 bytes

hello, suppose, entered input is of 1-40 bytes, i need it to be converted to 40 bytes exactly. example: if i have entered my name anywhere between 1-40 i want it to be stored with 40 bytes exactly. enter your name: donald duck (this is of 11 bytes) expected is as below - display 11... (3 Replies)
Discussion started by: shravan.300
3 Replies

4. UNIX for Dummies Questions & Answers

AWK error - string cannot be longer than X bytes

Hi Friends, Could you please tell me why i am getting the below eror while working with awk. I am confused :confused: what to do ? awk: 0602-591 String 1,9,20,6,6 cannot be longer than 399 bytes. The source line is 1. The error context is >>> <<< awk: 0602-591... (2 Replies)
Discussion started by: i150371485
2 Replies

5. UNIX for Dummies Questions & Answers

X bytes of 0, Y bytes of random data, Z bytes of 5, T bytes of 1. ??

Hello guys. I really hope someone will help me with this one.. So, I have to write this script who: - creates a file home/student/vmdisk of 10 mb - formats that file to ext3 - mounts that partition to /mnt/partition - creates a file /mnt/partition/data. In this file, there will... (1 Reply)
Discussion started by: razolo13
1 Replies

6. Shell Programming and Scripting

awk failure - wraping input line

awk is failing because of input file is greater than 3000 bytes. ,'11 cannot be longer than 3,000 bytes. The input line number is 1.13071e+06. The file is abc.txt. The source line number is 1. Is there any way to wrap the input lines to avoid this error ? (or) adding newline character at... (4 Replies)
Discussion started by: ysvsr1
4 Replies

7. Shell Programming and Scripting

AWK input can not be longer than 3000 bytes

Hi, i have following line in my code. eport.pl < $4 | dos2ux | head -2000 | paste -sd\| - | awk -v S="$1" ' Issue is, i get a message saying "awk:input line | found /file/path cannot be longer than 3000 bytes." "source line number is 3" Can someone help me with this please? (4 Replies)
Discussion started by: usustarr
4 Replies

8. Programming

Number of bytes in terminal input queue w/o blocking and consuming?

Hello, everyone. Could someone, please, tell me how to get the number of bytes in the terminal input queue without blocking and without consuming these bytes? I guess it could be called the peek functionality. I've looked at termio tcgetattr() and tcsetattr() functions but could not find... (4 Replies)
Discussion started by: Lucy.Garfeld
4 Replies

9. Shell Programming and Scripting

80 bytes per line ???

I am creating ASCII file from Oracle procedure into Unix box. I undertstand there is NO CRLF as I am writing it into one complete string .. but need to know what is best way to format the file with 80bytes per line only before handing over to another program. Thanks in advance regards... (14 Replies)
Discussion started by: u263066
14 Replies

10. News, Links, Events and Announcements

Microsoft "Donates" $3,000,000,000 to Feds

Surreal quote from the news link below: http://www.washingtonpost.com/wp-dyn/articles/A44615-2002Nov12.html (0 Replies)
Discussion started by: Neo
0 Replies
Login or Register to Ask a Question