Menu

sed bug?

Help
2006-10-23
2012-07-26
  • Nobody/Anonymous

    Hi, I'm not a sed wizard but is something wrong with the sed output bellow:

    $ sed --version
    GNU sed version 4.1.4
    Copyright (C) 2003 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions. There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE,
    to the extent permitted by law.

    $ echo "bug:me" | sed 's/[:]/ /'
    bug me

    $ echo "bug:me" | sed 's/:/ /'
    C:\msys\local\bin\sed.exe: -e expression #1, char 13: unknown option to `s'

    $ echo "bug:me" | sed 's/\:/ /'
    C:\msys\local\bin\sed.exe: -e expression #1, char 9: unknown option to `s'

    $ echo "bug:me" | sed 's+:+ +'
    bug me

    $ echo "bug:me" | sed 's+\:+ +'
    bug me

    I sent bug report to maintainer but he said to report it to gnuwin32...

     
    • Nobody/Anonymous

      you are right it's some bash thing...

       
    • Nobody/Anonymous

      Use double quotes (") instead of single quotes (') in the sed edit command:

      echo "bug:me" | sed "s/[:]/ /"

      See the section Filename globbing and quoted arguments on
      http://gnuwin32.sourceforge.net/install.html

       
    • Nobody/Anonymous

      If someone thinks it's quote problem - could you please post output of the commands in the first post with double quotes?

      Here is mine...
      $ echo "bug:me" | gnused.exe "s/\:/ /"
      C:\msys\local\bin\gnused.exe: -e expression #1, char 9: unknown option to `s'

      $ echo "bug:me" | gnused.exe "s/:/ /"
      C:\msys\local\bin\gnused.exe: -e expression #1, char 13: unknown option to `s'

      Thanks

       
      • Nobody/Anonymous

        The output of

        echo "bug:me" | sed.exe "s/\:/ /"

        is

        "bug me"

        BTW, I'm using the Windows command prompt (cmd.exe), whereas you use Bash. Perhaps that makes the difference. Or perhaps your sed.exe is not the GnuWin32 one, or not the latest build.

         
MongoDB Logo MongoDB