RE: extracting with sed

From: Bobak, Mark <Mark.Bobak_at_proquest.com>
Date: Fri, 5 Feb 2010 12:00:01 -0500
Message-ID: <6AFC12B9BFCDEA45B7274C534738067F3B967F75_at_AAPQMAILBX02V.proque.st>



Well, since no one else has answered yet, I'll show you my (really ugly) solution:
[oracle_at_msrac201 ~]$ cat log.txt

SQL> _at_.[%OSAUTH_PREFIX_DOMAIN%]
SP2-0310: unable to open file ".[FALSE]" SQL> spool off
[oracle_at_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.

But this works...

-Mark

From: oracle-l-bounce_at_freelists.org [mailto:oracle-l-bounce_at_freelists.org] On Behalf Of Mohammed Mehraj Hussain Sent: Friday, February 05, 2010 5:17 AM
To: oracle-l
Subject: extracting with sed

Hi all,

i have a log file which consists of the below text Code:

SQL> _at_.[%OSAUTH_PREFIX_DOMAIN%]

SP2-0310: unable to open file ".[FALSE]"

SQL> spool off

From this file i need to extract the text from the second line in between [] (i.e) False and need to put this output to a another file...

How can i do this with SED command

--
http://www.freelists.org/webpage/oracle-l
Received on Fri Feb 05 2010 - 11:00:01 CST

Original text of this message