Computing.Net > Forums > Unix > awk record too long

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

awk record too long

Reply to Message Icon

Name: sodiska
Date: September 30, 2003 at 03:08:28 Pacific
OS: SunOS5.8
CPU/Ram: not sure
Comment:

Hi,
I am writting a csh script to process a file with lines that are very long hence when i invoke awk for process it will comes out with this error : Record Too Long. Can anyone please help me out ? Below is codes for processing the file and line:


set file_length=`wc -l $file_path/$file_name | cut -c1-8` # Count Lines
set file_length=`expr $file_length + 0` # Change Type
set length=1
echo file_le = $file_length
while ($length < $file_length) # Start Loop
set date=`head -$length $file_path/$file_name | tail -1 | awk '/^Date:./' | awk '{split($0,arr,", "); {split(arr[2],arr1);print arr1[2],arr1[1],arr1[3]}}' `
echo "$date"
#if ($date != "") then
# echo date not empty
#endif
#### BEGIN : GET CMP_ID ########
set cmp_id=`head -$length $file_path/$file_name | tail -1 | awk '/.cmp_id./' | awk '{split($0,temp,"&cmp_id="); split(temp[2],t,"="); print t[2]}'`
#echo "$line" #>> $output_file # Write Line
if ($cmp_id != "") then
echo "======================"
echo "$cmp_id"
echo not empty
echo "========================"
endif
##### END : GET CMP_ID #####################
set length=`expr $length + 1` # Increment
end



Sponsored Link
Ads by Google

Response Number 1
Name: Nails
Date: September 30, 2003 at 10:55:27 Pacific
Reply:

Hi:

The only way of handling the "line too long" awk problem is to get a copy of GNU awk, gawk. It doesn't seen to have this problem.

Check out http://www.gnu.org.

Regards,

Nails


0

Response Number 2
Name: sodiska
Date: September 30, 2003 at 18:42:27 Pacific
Reply:

Hi Nails,
Thanks for the info. If say, I wish to process each line by line without using awk or perl, how will I be able to do it?


0

Response Number 3
Name: Nails
Date: September 30, 2003 at 20:51:53 Pacific
Reply:

Hi:

I've never had this problem, so I'm just guessing. You might try:

1) the fold command
2) the cut command

There's a good chance the above commands will have the same problems.

Regards,

Nails


0

Response Number 4
Name: WilliamRobertson
Date: October 1, 2003 at 00:44:49 Pacific
Reply:

Since it looks like you're on Solaris, nawk should be available. You could also try /usr/xpg4/bin/awk (the POSIX standard compliant version).

You may also be able to do something similar in sed.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


How to generate xls file ... Openbsd boot disc



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: awk record too long

Output line too long www.computing.net/answers/unix/output-line-too-long/5623.html

alternative for awk ' substr ' www.computing.net/answers/unix/alternative-for-awk-substr-/7747.html

The parameter list is too long (AIX) www.computing.net/answers/unix/the-parameter-list-is-too-long-aix/2584.html