Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need Help - Going Crazy With AWK

Status
Not open for further replies.

rickcfl

Programmer
Oct 25, 2007
1
US
Can anyone tell me how to extract only the text between two patters from a record and store it in a variable? Thanks in advance for any help here...
 
In your awk manual have a look at the sub function.
You may also consider the match and substr functions.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Hi

Or depending on the context setting the [tt]FS[/tt] may also help :
Code:
[blue]master #[/blue] echo 'Who the ( censored ugly word ) is Alice ?' | awk -F'\\(|\\)' '{print$2}'
 censored ugly word

Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top