Sponsored Content
Top Forums Shell Programming and Scripting Grep string with regex numeric characters Post 302974713 by RudiC on Thursday 2nd of June 2016 12:57:16 PM
Old 06-02-2016
How about
Code:
grep "Cause Indicators=[0-9][0-9] 90" file


Regarding your code sample: You may want to get accustomed to using quotes - be they single or double - in pairs, except for few and rare cases.

Last edited by RudiC; 06-02-2016 at 02:13 PM..
This User Gave Thanks to RudiC For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sed, grep, awk, regex -- extracting a matched substring from a file/string

Ok, I'm stumped and can't seem to find relevant info. (I'm not even sure, I might have asked something similar before.): I'm trying to use shell scripting/UNIX commands to extract URLs from a fairly large web page, with a view to ultimately wrapping this in PHP with exec() and including the... (2 Replies)
Discussion started by: ropers
2 Replies

2. Shell Programming and Scripting

With Regex Spliting the string into Alphanumeric and Numeric part

Hi there With shell script I'm trying to split the string into two parts. One is alphanumeric part, the other one is a numeric part. dummy_postcode_1 = 'SL1' --> res_alpha = 'SL' and res_numeric = '1' dummy_postcode_2 = 'S053' --> res_alpha = 'S' and res_numeric = '053' ... (1 Reply)
Discussion started by: ozgurgul
1 Replies

3. UNIX for Dummies Questions & Answers

Regex to match when input is not a certain string (can't use grep -v)

Hey everyone, Basically, all I'm looking for is a way to regex for not a certain string. The regex I'm looking to avoid matching is: D222 i.e. an equivalent of: awk '!/D222/' The problem is that I use this in the following command in a Bash script: ls ${source_directory} | awk... (1 Reply)
Discussion started by: kdelok
1 Replies

4. Shell Programming and Scripting

grep fixed string with regex

Hello, all! Maybe the title is badly formulated, you can help me with that...! I'm using the GNU grep, and I need to make sure that grep will extract only what I tell it to. I have the following regular expression: *? Well, I need to make sure I grep only a word which may start with a... (11 Replies)
Discussion started by: teresaejunior
11 Replies

5. Shell Programming and Scripting

grep regex, match exact string which includes "/" anywhere on line.

I have a file that contains the 2 following lines (from /proc/mounts) /dev/sdc1 /mnt/backup2 xfs rw,relatime,attr2,noquota 0 0 /dev/sdb1 /mnt/backup xfs rw,relatime,attr2,noquota 0 0 I need to match the string in the second column exactly so that only one result is returned, e.g. > grep... (2 Replies)
Discussion started by: jelloir
2 Replies

6. Shell Programming and Scripting

Generate Regex numeric range with specific sub-ranges

hi all, Say i have a range like 0 - 1000 and i need to split into diffrent files the lines which are within a specific fixed sub-range. I can achieve this manually but is not scalable if the range increase. E.g cat file1.txt Response time 2 ms Response time 15 ms Response time 101... (12 Replies)
Discussion started by: varu0612
12 Replies

7. Shell Programming and Scripting

Regex to exclude numeric

Dear All, My regex is like below. Its says all the number in coloum is include. 11666 11777 11888 ^(?\: (0|11)(666|777|888))\\d+$ How to exclude all the numeric that not mentioned in above regex. Regards, (3 Replies)
Discussion started by: tpx99
3 Replies

8. Shell Programming and Scripting

Grep with regex containing one string but not the other

Hi to you all, I'm just struggling with a regex problem and I'm pretty sure that I'm missing sth obvious... :confused: I need a regex to feed my grep in order to find lines that contain one string but not the other. Here's the data example: 2015-04-08 19:04:55,926|xxxxxxxxxx| ... (11 Replies)
Discussion started by: stresing
11 Replies

9. Shell Programming and Scripting

Grep with Regex multiple characters

Hi everyone, So I'm a bit confused about a regex pattern that should exist, but I can't really find any way to do it... Let's say I want to match any lines that have a specific string, but I don't know the order of the letters but I know the length. Let's say it's 10 characters and begins... (3 Replies)
Discussion started by: Lost in Cyberia
3 Replies

10. Shell Programming and Scripting

Grep a particular string from column eliminating characters at the end.

Hi, So basically I have this file containing query output in seperated columns. In particular column I have the below strings: news news-prio I am trying to grep the string news without listing news-prio aswell. I tried grep "$MSG_TYPE" , grep -w "$MSG_TYPE" , grep... (4 Replies)
Discussion started by: nms
4 Replies
ZGREP(1)						      General Commands Manual							  ZGREP(1)

NAME
zgrep - search possibly compressed files for a regular expression SYNOPSIS
zgrep [ grep_options ] [ -e ] pattern filename... DESCRIPTION
Zgrep invokes grep on compressed or gzipped files. These grep options will cause zgrep to terminate with an error code: (-[drRzZ]|--di*|--exc*|--inc*|--rec*|--nu*). All other options specified are passed directly to grep. If no file is specified, then the standard input is decompressed if necessary and fed to grep. Otherwise the given files are uncompressed if necessary and fed to grep. If the GREP environment variable is set, zgrep uses it as the grep program to be invoked. EXIT CODE
2 - An option that is not supported was specified. AUTHOR
Charles Levert (charles@comm.polymtl.ca) SEE ALSO
grep(1), gzexe(1), gzip(1), zdiff(1), zforce(1), zmore(1), znew(1) ZGREP(1)
All times are GMT -4. The time now is 04:05 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy