Use python with regex.

If DATA is like this

hi welcome to (hello world)
welcome to ( fun world)

Output
hello world
fun world

below is the sample code.

file = open("file.txt",r)
x= file.read()
file.close()

required_output = re.findall(.*\(.*\).*,x)

print required_output -----> which will display list

On Fri, Mar 26, 2010 at 1:20 AM, Geethasanthosh Kanugovi <
[email protected]> wrote:

> You can use regular expressions to achieve this if they follow the pattern
> which you mentioned in the email (PATTERN: text followed by info in
> paranthesis and again text).
>
>    ______________________________
> Thanks & Regards,
> Geethasanthosh Kanugovi.
>
> I will not say I have failed 1000 times I will say I have found 1000 ways
> that can cause failure.
>
>
>
>
> --- On *Thu, 3/25/10, Chandra_Dasaka 
> <[email protected]>*wrote:
>
>
> From: Chandra_Dasaka <[email protected]>
> Subject: RE: [twincling] help!
> To: "[email protected]" <[email protected]>
> Date: Thursday, March 25, 2010, 9:25 AM
>
>
>  Dear all, Need some help.
>
> I have a text file. This contains variable length records. Each record has
> some text (variable length) followed by some info within parenthesis () then
> some other text (again variable length). Can I extract the text which is
> enclosed within the parenthesis ? If yes, how?  Appreciate your help
>
>
>
> Best Regards,
>
> Chandra S Dasaka
> ------------------------------
> DISCLAIMER:
> This email (including any attachments) is intended for the sole use of the
> intended recipient/s and may contain material that is CONFIDENTIAL AND
> PRIVATE COMPANY INFORMATION. Any review or reliance by others or copying or
> distribution or forwarding of any or all of the contents in this message is
> STRICTLY PROHIBITED. If you are not the intended recipient, please contact
> the sender by email and delete all copies; your cooperation in this regard
> is appreciated.
>
>
>


-- 
      praca"sh.."

Reply via email to