Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
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

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

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?

Hi:
I've never had this problem, so I'm just guessing. You might try:1) the fold command
2) the cut commandThere's a good chance the above commands will have the same problems.
Regards,
Nails

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.

![]() |
How to generate xls file ...
|
Openbsd boot disc
|

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