Operating System - HP-UX
1748275 Members
3727 Online
108761 Solutions
New Discussion юеВ

Re: awk: Line SELECT arl_region_co cannot have more than 199 fields?

 
friend_1
Occasional Advisor

awk: Line SELECT arl_region_co cannot have more than 199 fields?

Hi,

i am not able run following script.please do the needful

Script:
ora_error.sh

sdate=`date +%a" "%b" "%e`
awk -vvar="$sdate" '$0 ~ var {x++} /ORA/ && x' /oracle/app/admin/bdump/alert.log >> /home/oracle/ora_err.txt


ERROR:
awk: Line SELECT arl_region_co cannot have more than 199 fields.
The input line number is 462333. The file is /oracle/app/admin/bdump/alert.log.
The source line number is 1.

Thanks,

6 REPLIES 6
Dennis Handly
Acclaimed Contributor

Re: awk: Line SELECT arl_region_co cannot have more than 199 fields?

This looks like a continuation of your previous thread:
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1330239

If you aren't using fields, you need to fool awk into using some different field delimiter:
awk -F"^A" -vvar="$sdate" '$0 ~ var {x++} /ORA/ && x' /oracle/app/admin/bdump/alert.log >> /home/oracle/ora_err.txt

I've used a control-A after that -F.
friend_1
Occasional Advisor

Re: awk: Line SELECT arl_region_co cannot have more than 199 fields?

Hi,

thanks it is working. i have one more problem. i want two extract two fields. that fields are ORA and SYSTEM

Thanks,
Dennis Handly
Acclaimed Contributor

Re: awk: Line SELECT arl_region_co cannot have more than 199 fields?

>I want two extract two fields. that fields are ORA and SYSTEM

This is a problem, we just got through removing all fields.

What is your definition of a field for "ORA and SYSTEM"?
I suppose you could use split($0, fields, "[[:space:]]*"). You would then have to ignore the first field if empty.
friend_1
Occasional Advisor

Re: awk: Line SELECT arl_region_co cannot have more than 199 fields?

Hi,

awk -F"^A" -vvar="$sdate" '$0 ~ var {x++} /ORA/ && x' /oracle/app/admin/bdump/alert.log >> /home/oracle/ora_err.txt

this script is providing all ORA error. but i want to get ORA200 and ora300 errors only

Thanks,
ghostdog74
Occasional Advisor

Re: awk: Line SELECT arl_region_co cannot have more than 199 fields?

you can use split inside awk

awk '{
m=split($0,a,")
for (i=1 ;i<=m;i++){
if ($i ~ /ORA/){
print
}
}
} yourfile
Dennis Handly
Acclaimed Contributor

Re: awk: Line SELECT arl_region_co cannot have more than 199 fields?

>I want to get ORA200 and ora300 errors

awk -F"^A" -vvar="$sdate" '
$0 ~ var {x++}
(/ORA200/ || /ora300/) && x { print $0 }'