Re: extracting with sed
Date: Fri, 05 Feb 2010 18:23:48 +0100
Mohammed Mehraj Hussain writes:
> 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
The following should do it:
sed -ne '/^SP2-[0-9]*:/s/^\(.*\[\)\(.*\)\(\].*\)$/\2/p' /tmp/f.log
It looks for a line starting with SP2 and a number, breaks that in three parts by taking [ and ] as delimiters and prints the second part.