The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 04-19-2007
cursive cursive is offline
Registered User
  
 

Join Date: Apr 2007
Posts: 6
Select text within matching ( ) bracket

Hi,

I am looking for a simple command to select text within a open bracket "("
and a matching close bracket ")" and output the within-bracket-text to a file.
This function is similar to the common vi select a range of text with "(" to ")"
but not sure how to run the same function in command line.

Here's the input file :

statement statement statement
statement statement statement
statement statement statement

Today( "here"

MONDAY = map( "monday")
TUESDAY = map( "tuesday" )

WESNESDAY = map( "wednesday" )
THURSDAY = map( "thursday" )
FRIDAY = map( "friday" )

SATURDAY = map( "saturday" )
SUNDAY = map( "sunday" )

);

statement statement statement
statement statement statement
statement statement statement

Output file :
--------------

Today( "here"

MONDAY = layer( "monday" )
TUESDAY = layer( "tuesday" )

WESNESDAY = layer( "wednesday" )
THURSDAY = layer( "thursday" )
FRIDAY = layer( "friday" )

SATURDAY = pinText( "saturday" )
SUNDAY = pinText( "sunday" )

);


Thanks in advance,
cursive