code differences

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kaarthikeyapreyan
    New Member
    • Apr 2007
    • 106

    code differences

    I am interested to know why the ip are not listed with the -w option in grep
    It works fine on my ubuntu 8.04 version(bash) but not in my HP-UX Release 11i (ksh)

    Code:
    mysys:/tmp/x->find . -type f -print | xargs grep -n -w '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}'
    mysys:/tmp/x->find . -type f -print | xargs grep -n '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}'
    ./test/myfile.txt:2:this line contains ip 192.162.110.2
    ./test/myfile.txt:3:mutliple ip on single line 193.254.110.23 ans with the 10.10.10.1
    ./test/testfile2.txt:2:192.23.345.45
    ./test/testfile2.txt:3:includes ip configured to match teh currenmt 10.11.101.23
    Last edited by kaarthikeyapreyan; Oct 27 '09, 12:18 PM. Reason: updated info
  • micmast
    New Member
    • Mar 2008
    • 144

    #2
    what version of grub is on both machines?

    Comment

    • gits
      Recognized Expert Moderator Expert
      • May 2007
      • 5390

      #3
      do you mean grep? just wondering ... :) .... to get the version of grep you might use:

      Code:
      grep -V
      gives you something like:

      Code:
      GNU grep 2.5.4
      
      Copyright (C) 2009 Free Software Foundation, Inc.
      License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
      This is free software: you are free to change and redistribute it.
      There is NO WARRANTY, to the extent permitted by law.
      kind regards

      Comment

      • kaarthikeyapreyan
        New Member
        • Apr 2007
        • 106

        #4
        There was no version information attached to the grep.
        but the STANDARDS CONFORMANCE
        grep: SVID2, SVID3, XPG2, XPG3, XPG4, POSIX.2

        Code:
        hp:/preyan->grep -V
        grep: illegal option -- V
        usage: grep [-E|-F] [-c|-l|-q] [-bhinsvx] -e pattern_list...
                [-f pattern_file...] [file...]
        usage: grep [-E|-F] [-c|-l|-q] [-bhinsvx] [-e pattern_list...]
                -f pattern_file... [file...]
        usage: grep [-E|-F] [-c|-l|-q] [-bhinsvx] pattern [file...]
        the grep command works as desired in my linux box with the bash shell
        but i am interested to know why this is not the same in the HP-UX Release 11i
        though it is complaint ot the standard.

        Comment

        • kaarthikeyapreyan
          New Member
          • Apr 2007
          • 106

          #5
          Originally posted by micmast
          what version of grub is on both machines?
          Just got curious on this reply, how does grub play a role in this issue ?
          or was that a typo

          Comment

          • gits
            Recognized Expert Moderator Expert
            • May 2007
            • 5390

            #6
            perhaps:

            Code:
            grep --version
            works to get the verision info? i suspect the -w option could be the problem - just a guess based on the last output you posted?

            kind regards

            Comment

            • micmast
              New Member
              • Mar 2008
              • 144

              #7
              Originally posted by kaarthikeyaprey an
              Just got curious on this reply, how does grub play a role in this issue ?
              or was that a typo
              it doesn't, it should be grep :)
              my typing is worse then your average joe, sorry for that :)

              Comment

              • kaarthikeyapreyan
                New Member
                • Apr 2007
                • 106

                #8
                Originally posted by gits
                perhaps:

                Code:
                grep --version
                works to get the verision info? i suspect the -w option could be the problem - just a guess based on the last output you posted?

                kind regards
                Yes it is the problem and --version is also an illegal option
                -w does not work as expected in this grep.
                this does not integrate any version information.

                Comment

                • gits
                  Recognized Expert Moderator Expert
                  • May 2007
                  • 5390

                  #9
                  ok ... since it just seems to be clear that it works differently on both of the machines i would suggest to just avoid the -w option and use a regExp instead ... or have a look here at a similar question at the HP resource center

                  kind regards

                  Comment

                  Working...