Thread: Very Useful, BUT its a Doubt

  1. #1
    Registered User
    Join Date
    Oct 2007
    Posts
    36

    Thumbs up Very Useful, BUT its a Doubt

    Hi folks,

    I have some doubts regarding editing a file in Linux.

    The problem is that, if my file consists something as

    Code:
    cavestine is a good boy
    cavestine is studying in MIT
    cavestine likes Kernel programming
    cavestine is an active member of cprogramming.com forum.
    Now in this file I want to remove "cavestine" by "mark"

    Then I can open the file and use the following command to do so.

    Code:
    :%s/cavestine/mark/g
    But the issue is if there are more than 1 file in a directory and I want to replace "cavestine" by "mark" in all files WITHOUT using any script, is there any such command to do so. I DONT want to open individual file and edit as above.

    is "sed" the right command to use

    thanx in advance

    -- cavestine

  2. #2
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    You could use sed in combination with find, or you could use a for loop on the command line.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Doubt in pointer.
    By shwetha_siddu in forum C Programming
    Replies: 5
    Last Post: 03-21-2009, 01:28 AM
  2. Replies: 4
    Last Post: 12-10-2006, 07:08 PM
  3. Doubt abt Storage!
    By kalamram in forum C Programming
    Replies: 1
    Last Post: 04-21-2006, 05:30 AM
  4. arrays doubt
    By j0nnyX in forum C Programming
    Replies: 4
    Last Post: 11-20-2004, 01:10 PM
  5. Greatest C++ Doubt
    By vasanth in forum C++ Programming
    Replies: 15
    Last Post: 02-28-2002, 04:41 AM