1846992 Members
3592 Online
110257 Solutions
New Discussion

HP-UX grep command Error

 
dbbarua
New Member

HP-UX grep command Error

Hi i found the following error in the HP-UX grep command the error has been registered under defect report no 8606425190.
5 REPLIES 5
Arunvijai_4
Honored Contributor

Re: HP-UX grep command Error

Hello,

Which version of HP-UX you are running ? (# uname -a), and what is the patch level of your server ? (#show_patches or # swlist -l patch

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Dietmar Konermann
Honored Contributor

Re: HP-UX grep command Error

dbbarua,

just had a quick look at that code and for me this seems to be caused by a little bug that has been introduced with the addition of the new the -w option some time ago.

The grep cmdline option parser goes to an infinite loop, if:

- the w option appears in option block #2 -AND-
- the w option is not the last option in option block #2

Examples (X does not matter):

grep -X -wX
->loops

grep -wX
->does not loop

grep -X -w
->does not loop

Workaround for your example in 8606425190/JAGaf84710:

# ls -l | grep -lwi -f ./t

instead of:

# ls -l | grep -l -wi -f ./t

Best regards...
Dietmar.

"Logic is the beginning of wisdom; not the end." -- Spock (Star Trek VI: The Undiscovered Country)
Dietmar Konermann
Honored Contributor

Re: HP-UX grep command Error

Urgs.
Aftrer having a closer look I don't believe that the -w option could *ever* work together with the -f option. So forget my suggestion above...

Best regards...
Dietmar.
"Logic is the beginning of wisdom; not the end." -- Spock (Star Trek VI: The Undiscovered Country)
dbbarua
New Member

Re: HP-UX grep command Error

Hai i work on HP-UX Build 11.11 and i have to check out the patch level when i and work tommrrow.
dbbarua
New Member

Re: HP-UX grep command Error

Hai Guys here is the full bug report.