Sponsored Content
Top Forums Shell Programming and Scripting Egrep -v command not filtering correctly Post 303033024 by evergreen on Thursday 28th of March 2019 03:46:23 PM
Old 03-28-2019
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.
Code:
$ 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:
Code:
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.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

egrep command

I'd like to grep a pattern of a version number as *_number.number.number number should be digit my grep is |egrep '^*++\.+' It works for V_3.2.1 or V _5.3.2 but not with V_43.6.543 !!!!! How can I specify any repetition of digit in the ? thanks, (4 Replies)
Discussion started by: annelisa
4 Replies

2. Shell Programming and Scripting

Help with egrep command

Hi All, I am using egrep command to search one pattern. Following is the command i am using egrep -i "ACL*" filename but its also giving me the records which do not contain ACL. any help would be appreciated. Regards, Sam (3 Replies)
Discussion started by: sam25
3 Replies

3. Shell Programming and Scripting

Query regarding egrep command

Hi All, I am having a query regarding the usage of egrep command. i am having two unix environmanets in environment when i am using "egrep -f" it is working fine and other unix environment i am getting a syntax error. Please let me know if i need to set any environmane variables. ... (12 Replies)
Discussion started by: Sriram.Vedula53
12 Replies

4. UNIX for Dummies Questions & Answers

Date command to obtain the last month is not working correctly..

Hello, I could not find the exactly same post here.. so I will explain what I did to get the last month using date command. I used date +%Y-%m -d "-1 months" to get the last month. However, the returned value of above command on 2009/10/31 was 2009 10 and not 2009 09.. and the... (9 Replies)
Discussion started by: tigersk
9 Replies

5. Shell Programming and Scripting

CRON shell script only runs correctly on command line

Hi, I'm new to these forums, and I'm hoping that someone can solve this problem... To make things short: I have DD-wrt set up on a router. I'm trying to run a script in CRON that fetches the daily password from my database using SSH. CRON is set like so(in web interface): * * * *... (4 Replies)
Discussion started by: louieaw
4 Replies

6. Shell Programming and Scripting

egrep command and order

Hi All, Here is my question. I have two files, file1.txt and file2.txt. I need the line number (index number) of file2.txt where the words in file1.txt appear. But they have to be in the same order as file1.txt. In example, file1.txt Z K A ... T file2.txt W A Q R (6 Replies)
Discussion started by: senayasma
6 Replies

7. Shell Programming and Scripting

Help with egrep command

cat /tmp/inventory.csv|grep AARP|egrep -v "T11|12.4\(7\)" how do i exclude in addition to above 12.4\(3\) I have tried adding this in i.e -v "T11|12.4\(7\)|12.4\(3\)" but it did not work (3 Replies)
Discussion started by: slashbash
3 Replies

8. Shell Programming and Scripting

Help with egrep command

Hello folks, Here's how my current egrep command works: egrep "NY|DC|LA|VA|MD" state_data.txt I am planning to use a file to enter all allowable state values like say a new state_names.lookup with the following data: NY DC LA VA MD egrep "`cat state_names.lookup`"... (6 Replies)
Discussion started by: calredd
6 Replies

9. Shell Programming and Scripting

help in egrep command in file

Hi Guys, I need hepl on egrep commnad I have one file and i need grep only specific lines.. EX: 2012-04-01 02:15:14 w 2012-04-01 02:15:14 w 2012-04-01 02:15:14 w 2012-10-26 02:15:14 w 2012-04-01 02:15:14 w 2012-10-26 02:15:14 w 2012-10-26 02:15:14 w 2012-10-26 03:18:56 M... (1 Reply)
Discussion started by: asavaliya
1 Replies

10. UNIX for Beginners Questions & Answers

Egrep command is not working for me

my file is below REREGISTER is something to Failed to create the request Failed to create the request in not easy I know how REREGISTERcommand i run is egrep 'REREGISTER|Failed|to|create|the|request' test1 expected output REREGISTER is something to Failed to create the request i should... (2 Replies)
Discussion started by: mirwasim
2 Replies
XZGREP(1)							     XZ Utils								 XZGREP(1)

NAME
xzgrep - search compressed files for a regular expression SYNOPSIS
xzgrep [grep_options] [-e] pattern file... xzegrep ... xzfgrep ... lzgrep ... lzegrep ... lzfgrep ... DESCRIPTION
xzgrep invokes grep(1) on files which may be either uncompressed or compressed with xz(1), lzma(1), gzip(1), or bzip2(1). All options specified are passed directly to grep(1). If no file is specified, then the standard input is decompressed if necessary and fed to grep(1). When reading from standard input, gzip(1) and bzip2(1) compressed files are not supported. If xzgrep is invoked as xzegrep or xzfgrep then egrep(1) or fgrep(1) is used instead of grep(1). The same applies to names lzgrep, lze- grep, and lzfgrep, which are provided for backward compatibility with LZMA Utils. ENVIRONMENT
GREP If the GREP environment variable is set, xzgrep uses it instead of grep(1), egrep(1), or fgrep(1). SEE ALSO
grep(1), xz(1), gzip(1), bzip2(1), zgrep(1) Tukaani 2009-07-05 XZGREP(1)
All times are GMT -4. The time now is 06:11 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy