"Aaron Gray" <[EMAIL PROTECTED]> writes: > "Dan C" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> On Mon, 28 Jan 2008 14:48:19 +0000, Aaron Gray wrote: >> >>> I need to print out all instances of the string expression >>> 'this\-\>[a-zA-Z_]+' from a C++ file on separate lines. >> >> OK, go ahead. > > ??? :) > > AFAICT sed will not do this. Tried awk but could not fathom it.
* grep prints lines that match a pattern * tr transposes characters * sed edits line by line and uses regular expressions to match text * awk performs a huge variety of actions based on line-by-line addressing, which may include pattern-matching To do this in awk: # awk '/<pattern/ {print}' where '#' is your shell prompt. However, this is much easier to do in grep, since that's what grep is for. You would only use awk if you wanted to do something with it (something too complex or ungainly for sed). Joel -- Joel J. Adamson Biostatistician Pediatric Psychopharmacology Research Unit Massachusetts General Hospital Boston, MA 02114 (617) 643-1432 (303) 880-3109