regex in Unix

This is a discussion on regex in Unix within the Linux Programming forums, part of the Platform Specific Boards category; Could anybody tell me how to do this in Unix using vi: In the file "sue" use grep to print ...

  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 wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,484
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  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, 09: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, 07:44 PM
  4. <regex.h> regex syntax in C
    By battersausage in forum C Programming
    Replies: 7
    Last Post: 03-24-2004, 12: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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21