Announcement

Collapse
No announcement yet.

[SOLVED] sed - Stange Behavior

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [SOLVED] sed - Stange Behavior

    In trying to do some sed stuff, I am running "sed '/host/ s/$/QQQ/g' junk" on the file junk.

    File - junk
    Code:
    host Example_1
    filename-"gfnwd.cfg";
    hardware-ethernet-00:13:11:fd:7a:88;
    fixed-address-10.10.6.19;
    }
    host Example_2
    filename-"gfnwd_280.cfg";
    hardware-ethernet-00:10:3d:14:30:ce;
    fixed-address-10.10.6.59;
    }
    host Example_13
    filename-"robnmic1.cfg";
    hardware-ethernet-00:10:3d:12:9e:c8;
    fixed-address-10.10.3.30;
    }
    The output of this command in Kubuntu 9.04 is:
    Code:
    QQQost Example_1
    filename-"gfnwd.cfg";
    hardware-ethernet-00:13:11:fd:7a:88;
    fixed-address-10.10.6.19;
    }
    QQQost Example_2
    filename-"gfnwd_280.cfg";
    hardware-ethernet-00:10:3d:14:30:ce;
    fixed-address-10.10.6.59;
    }
    QQQost Example_13
    filename-"robnmic1.cfg";
    hardware-ethernet-00:10:3d:12:9e:c8;
    fixed-address-10.10.3.30;
    While in Fedora 11, it is:
    Code:
    host Example_1QQQ
    filename-"gfnwd.cfg";filename-"gfnwd.cfg";
    hardware-ethernet-00:13:11:fd:7a:88;
    fixed-address-10.10.6.19;
    }
    host Example_2QQQ
    filename-"gfnwd_280.cfg";
    hardware-ethernet-00:10:3d:14:30:ce;
    fixed-address-10.10.6.59;
    }
    host Example_13QQQ
    filename-"robnmic1.cfg";
    hardware-ethernet-00:10:3d:12:9e:c8;
    fixed-address-10.10.3.30;
    }
    Anyone heard of any goofy stuff with sed like this in (K)Ubuntu?

    #2
    Re: sed - Stange Behavior

    Shocking ! Are you using bash in both? It seems only in Fedora it is doing the right thing, no?

    Comment


      #3
      Re: sed - Stange Behavior

      In Kubuntu 9.10 and Debian sid it adds the QQQ at the end of the line.

      Comment


        #4
        Re: sed - Stange Behavior

        It might be useful if you guys all post the exact version of sed used in each case. I thought it could also be the shell (thinking that the standard input is read differently in both some particular shell)

        Comment


          #5
          Re: sed - Stange Behavior

          I guess here is what I've got. I'm not sure what more information you'd like.

          Code:
          dpich@dpich-M6400:$ uname -a       
          Linux dpich-M6400 2.6.28-13-generic #44-Ubuntu SMP Tue Jun 2 07:57:31 UTC 2009 i686 GNU/Linux
          dpich@dpich-M6400:$ sed --version
          GNU sed version 4.1.5                
          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.                      
          dpich@dpich-M6400:$ sudo dpkg -l | grep sed
          ii sed                    4.1.5-8                  The GNU sed stream editor
          I'm running /bin/bash. I did try /bin/sh, and it did the same thing.

          One thing that I've done recently is added the repositories for KDE 4.2.4. I'm not sure if that is part of this or not. But there were a lot of packages updated.

          I tried Xubuntu 9.04 x386 and that worked as expected.

          Please let me know if there is anything else I can track down for you.

          Comment


            #6
            Re: sed - Stange Behavior

            Is it a Dash quirk?

            You can sudo dpkg-reconfigure dash to change the shell to bash, and try your sed thing that way.

            Comment


              #7
              Re: sed - Stange Behavior

              If run from a interactive bash shell, dash shouldn't come into play.

              I'd suspect it's a sed bug, as (like mando_hacker already mentioned) it works as expected in karmic with sed 4.2

              EDIT: just noticed you tried it on xubuntu 9.04 where it works as it should, so it's probably not a sed bug after all...try running it from a virtual terminal (Ctrl+Alt+F1) to check if it's a bug in konsole instead.

              Comment


                #8
                Re: sed - Stange Behavior

                I got into vty1 (ctrl+alt+F1) and did the same test. It gave me the same results. It doesn't appear to do with kde 4.2.4.

                Is anyone else seeing this on 9.04? I'm just hoping I don't send anyone on a wild goose chase when it's just my system.

                Comment


                  #9
                  Re: sed - Stange Behavior

                  Originally posted by TheBigAmbulance
                  It doesn't appear to do with kde 4.2.4.
                  I don't see how any version differences in KDE (or Gnome or Xfce for that matter) should affect functions in a virtual terminal. The display manager isn't controlling anything there (or shouldn't be).



                  You could start booting your collection of Live CDs and see what you can learn running your routine in a virtual terminal under different versions of Linux.

                  Comment


                    #10
                    Re: sed - Stange Behavior

                    Originally posted by TheBigAmbulance
                    Is anyone else seeing this on 9.04? I'm just hoping I don't send anyone on a wild goose chase when it's just my system.
                    Yes, we should try. I can probably try tonight, unless someone else can try earlier. If this is a bug on 9.04 we should report it!

                    Comment


                      #11
                      Re: sed - Stange Behavior

                      I agree. I find it highly unlikely that the desktop apps would make a terminal app have kittens. But it was something I did before this happened.

                      Even more strange....

                      Tried the following distros (Live CD)
                      Ubuntu 9.04 - Kernel 2.6.28-11
                      Kubuntu 9.04 - Kernel 2.6.28-11
                      Xubuntu 9.04 - Kernel 2.6.28-11
                      Fedora 11 - Not Sure.

                      The only place that I'm now seeing this is on my live system running Kubuntu 9.04 i386 running Kernel 2.6.28-13. The Kubuntu 9.04 i386 liveCD sed presented the correct output.

                      UPDATE: I had a throw around laptop that I loaded Kubuntu 9.04 and then did all the upgrades I could including Kernel patches. I saw no problem with sed whatsoever. So I did a reinstall of sed on my system. Now it is preforming fine.

                      Go Figure! Thanks to all who responded!!!! At least I got it figured out.

                      Comment


                        #12
                        Re: [SOLVED] sed - Stange Behavior

                        Wow, how did we _not_ think of that! I am glad you got it !

                        Comment


                          #13
                          Re: [SOLVED] sed - Stange Behavior

                          Fixed, not figured out. We still have no idea what was happening.

                          Comment


                            #14
                            Re: [SOLVED] sed - Stange Behavior

                            If it happens again, I'll get this thread going again...

                            Comment


                              #15
                              Re: [SOLVED] sed - Stange Behavior

                              I went through every step from a fresh install to adding the repository for 4.2.4 like I did on the original system that was having issues. I have not been able to duplicate it whatsoever.

                              Could have been a one time one system problem I guess. I wish I had better news for the guys that would have liked to file this if it was a bug.

                              Comment

                              Working...
                              X