Egrep -v command not filtering correctly

Hello guys,

I have an issue when trying to do an egrep -v on a file, let me show you.
I want to filter the last column as to where it filters out the columns with asterisks and zeros ( * and 0 ) it is working properly up to a certain point where I have a value of '10000' which is also getting filtered by the '0'.

This is the result:
e.g.

$ egrep -v "\*|0" grep.txt
Queue                                        Get  Put  CurDepth
-----------------------------------------------------------------
SYSTEM.DEAD.LETTER.QUEUE                     EN   EN   712
WDW_ORDERS_ONEVIEW_Q                         EN   EN   1

This is the original list:

Queue                                        Get  Put  CurDepth
-----------------------------------------------------------------
SYSTEM.CLUSTER.COMMAND.QUEUE                 EN   EN   0
SYSTEM.CLUSTER.TRANSMIT.QUEUE                EN   EN   0
SYSTEM.DEAD.LETTER.QUEUE                     EN   EN   712
WDW_LVLN_Q                                   EN   EN   0
WDW_LVLN_Q_A                                 EN   EN   **
WDW_LVLN_Q_B                                 EN   EN   **
WDW_LVLN_Q_DARK                              EN   EN   0
WDW_ORDERS_ONEVIEW1_Q                        EN   EN   0
WDW_ORDERS_ONEVIEW1_Q_A                      EN   EN   **
WDW_ORDERS_ONEVIEW1_Q_B                      EN   EN   **
WDW_ORDERS_ONEVIEW1_Q_DARK                   EN   EN   0
WDW_ORDERS_ONEVIEW_Q                         EN   EN   1
WDW_ORDERS_ONEVIEW_Q_A                       EN   EN   **
WDW_ORDERS_ONEVIEW_Q_B                       EN   EN   **
WDW_ORDERS_ONEVIEW_Q_DARK                    EN   EN   0
WDW_RM_FULFL_TO_TPV3_Q                       EN   EN   0
WDW_RM_FULFL_TO_TPV3_Q_A                     EN   EN   **
WDW_RM_FULFL_TO_TPV3_Q_B                     EN   EN   **
WDW_RM_FULFL_TO_TPV3_Q_DARK                  EN   EN   0
WDW_TRAVELPLAN_V31_Q                         EN   EN   0
WDW_TRAVELPLAN_V31_Q_A                       EN   EN   **
WDW_TRAVELPLAN_V31_Q_B                       EN   EN   **
WDW_TRAVELPLAN_V31_Q_DARK                    EN   EN   0
WDW_TRAVELPLAN_V3_Q                          EN   EN   10000
WDW_TRAVELPLAN_V3_Q_A                        EN   EN   **
WDW_TRAVELPLAN_V3_Q_B                        EN   EN   **
WDW_TRAVELPLAN_V3_Q_DARK                     EN   EN   0
WDW_XBMS_TRAVEL_PLAN_BUNDLE_Q                EN   EN   0
WDW_XBMS_TRAVEL_PLAN_BUNDLE_Q_A              EN   EN   **
WDW_XBMS_TRAVEL_PLAN_BUNDLE_Q_B              EN   EN   **
WDW_XBMS_TRAVEL_PLAN_BUNDLE_Q_DARK           EN   EN   0
WDW_XBMS_TRAVEL_PLAN_Q                       EN   EN   0
WDW_XBMS_TRAVEL_PLAN_Q_A                     EN   EN   **
WDW_XBMS_TRAVEL_PLAN_Q_B                     EN   EN   **
WDW_XBMS_TRAVEL_PLAN_Q_DARK                  EN   EN   0

if you are able to see there is another column with a '10000' in the last column which should also be filtered in the first egrep -v result and is not showing.

can someone please help, I have tried also a awk syntax but to no avail, it keeps showin only 2 results instead of 3.

any help would be greatly appreciated. thanks guys.

Welcome to the forum.

How about:

grep -Ev "(\*| 0)$" file
Queue                                        Get  Put  CurDepth
-----------------------------------------------------------------
SYSTEM.DEAD.LETTER.QUEUE                     EN   EN   712
WDW_ORDERS_ONEVIEW_Q                         EN   EN   1
WDW_TRAVELPLAN_V3_Q                          EN   EN   10000
1 Like

grep does correctly, what you commanded to do.

the regex egrep -v "\*|0" grep.txt matches 10000.

Check the regex manual to improve your understanding of the topic(man 7 regex).

That would be more what you want:

grep -vE '([^0-9]0|\*)$' grep.txt
1 Like

thanks for your answers guys , I will go ahead and read the regex man page to get more ideas and a better understanding. :o:D