Thread: regex in Unix

  1. #1
    Registered User
    Join Date
    Nov 2001
    Posts
    2

    Question regex in Unix

    Could anybody tell me how to do this in Unix using vi:

    In the file "sue" use grep to print to screen all lines containing
    the word "boy" twice, i.e.
    "boy, life ain't easy for a boy named sue."

    Thanx in advance

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    Seems a little off topic
    How about
    boy.*boy
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Aug 2001
    Posts
    202
    I don't know about vi, but I know that ex (which drives vi) has script and (I think) regex capabilities.

    starX
    www.axisoftime.com
    ---------------
    starX
    www.axisoftime.com

  4. #4
    phubuh
    Guest
    I suck at the Vi, but with grep, just do "egrep 'boy.*boy'".

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to program in unix
    By Cpro in forum Linux Programming
    Replies: 21
    Last Post: 02-12-2008, 10:54 AM
  2. Setting up a Unix box
    By @nthony in forum Tech Board
    Replies: 6
    Last Post: 07-22-2007, 10:22 PM
  3. UNIX (Linux, BSD, etc) Programming :: UNIX
    By kuphryn in forum Linux Programming
    Replies: 6
    Last Post: 04-01-2004, 08:44 PM
  4. <regex.h> regex syntax in C
    By battersausage in forum C Programming
    Replies: 7
    Last Post: 03-24-2004, 01:35 PM
  5. About Unix Programming - Making a career desision
    By null in forum C Programming
    Replies: 0
    Last Post: 10-14-2001, 07:37 AM