OT: Using sed to replace only 1st instance?

From: David Oftedal (david@start.no)
Date: Tue Mar 04 2003 - 13:42:40 EST

  • Next message: Frank da Cruz: "Caron / Hacek?"

    Ah! Thank you, all. The keymap I was making is nearly finished.

    The problem, of course, with Japanese, is that there are lots of
    homonyms, so many of the entries in my keymap (About 2,000, in fact) are
    duplicates.

    I've made a program to make a list of all these words, and another
    program to that takes each entry in the list, assigns it a number, and
    then runs a command to append the number to the end of the entry.

    So instead of 4 entries named "kouen" in the keymap, I'll have "kouen1",
    "kouen2", "kouen3" and "kouen4".

    The problem is that sed, the command I ATTEMPTED to run from my program,
    replaces ALL entries by the name "kouen" with "kouen1" at once, so when
    my program looks for the entry to be named "kouen2", it's long gone,
    because they're all named "kouen1".

    Can I use sed to replace only the first instance of a phrase in a file?
    Or is there another command that could easily replace it?

    -Dave Oftedal

    -- 
    Sonna ojamasan ni ha batsu-geemu namatako pantsu juppun!
    


    This archive was generated by hypermail 2.1.5 : Tue Mar 04 2003 - 14:45:22 EST