|
|
|
awk record too long
|
Original Message
|
Name: sodiska
Date: September 30, 2003 at 03:08:28 Pacific
Subject: awk record too long 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
Report Offensive Message For Removal
|
|
Response Number 1
|
Name: Nails
Date: September 30, 2003 at 10:55:27 Pacific
|
Reply: (edit)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
Report Offensive Follow Up For Removal
|
|
Response Number 2
|
Name: sodiska
Date: September 30, 2003 at 18:42:27 Pacific
|
Reply: (edit)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?
Report Offensive Follow Up For Removal
|
|
Response Number 3
|
Name: Nails
Date: September 30, 2003 at 20:51:53 Pacific
|
Reply: (edit)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
Report Offensive Follow Up For Removal
|
|
Response Number 4
|
|
Reply: (edit)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.
Report Offensive Follow Up For Removal
|
Use following form to reply to current message:
|
|

|