Re: extracting with sed

From: Stefan Moeding <>
Date: Fri, 05 Feb 2010 18:23:48 +0100
Message-ID: <>


Mohammed Mehraj Hussain writes:

> 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.


Received on Fri Feb 05 2010 - 11:23:48 CST

Original text of this message