Re: extracting with sed

  • From: Mohammed Mehraj Hussain <mhdmehraj@xxxxxxxxx>
  • To: Mark.Bobak@xxxxxxxxxxxx, oracle-l <oracle-l@xxxxxxxxxxxxx>
  • Date: Mon, 8 Feb 2010 10:40:41 +0530

Hi ,

Here my intention is to read the OSAUTH_PREFIX_DOMAIN registry value and to
insert it in a oracle table...


Is there anyway to do this Efficiently?

Regards,
Mohammed

On Sat, Feb 6, 2010 at 5:03 PM, Tom Lanyon <tom@xxxxxxxxxxxxxx> wrote:

> On 06/02/2010, at 3:30 AM, Bobak, Mark wrote:
>
> > Well, since no one else has answered yet, I’ll show you my (really ugly)
> solution:
> > [oracle@msrac201 ~]$ cat log.txt
> > SQL> @.[%OSAUTH_PREFIX_DOMAIN%]
> > SP2-0310: unable to open file ".[FALSE]"
> > SQL> spool off
> > [oracle@msrac201 ~]$ cat log.txt|tail -2|head -1|awk -F[ '{ print$2
> }'|awk -F] '{ print $1}'
> > FALSE
> >
> > Yeah, I’m no awk or sed genius.  I use tail and head to get only the
> second line, then I need to use awk twice to parse out around each of the
> ‘[‘ and ‘]’.  Yes, I’m sure there’s a better and cleaner way.
>
> How about just awk?
>
>        awk  -F  '[\\[\\]]'   '/^SP2-/ {print $2}'  log.txt
>
> Look for any lines starting with SP2-, split based on '[' or ']' as a field
> delimiter and print the second field.
>
> Tom




-- 
Regards,
H.Mohammed Mehraj Hussain
Oracle DBA,
Honeywell Technology Solutions,

--“Please consider the environment before printing this email”--
Lets Go Green.

Other related posts: