Sponsored Content
Top Forums Shell Programming and Scripting egrep help required to find pattern Post 302519505 by Franklin52 on Wednesday 4th of May 2011 07:21:03 AM
Old 05-04-2011
Quote:
Originally Posted by gr8_usk
Thanks all for your help. One last question how can I exclude the pattern searched by below code,

Code:
awk '/--/;/\/\*/{p=1};p;/\*\//{p=0}' file

Something like this?
Code:
awk '/--/{next};/\/\*/{p=1};!p;/\*\//{p=0}' file

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

egrep a certain pattern

hey guys this is my first post here, heard a lot about these forums. Iam urgently in need of a command which would help me accomplish the following , for example a file has these contents: 211 61 2007-06-26 13:47:32 211 61 2007-06-26 09:53:43 211 61 2007-06-26 15:25:14 211 61 2007-06-26... (5 Replies)
Discussion started by: trust123
5 Replies

2. Shell Programming and Scripting

HOW to egrep fo a pattern

Hi, I want to use egrep to match this expression in my file. The expression begins with the word SCHEDULE and ends with PFTDGNIN. In between these 2 words there can be anything. EX: Line1: SCHEDULE NWERRR#PFTDGNIN Line2: FOLLOWS NWD@AAS#PFTDGNIN So as a result of the egrep command... (1 Reply)
Discussion started by: eliewadi
1 Replies

3. UNIX for Advanced & Expert Users

Urgent Help required : awk/sed help to find pattern and delete till end of line

Hi, I need help with using an awk or sed filter on the below line ALTER TABLE "ACCOUNT" ADD CONSTRAINT "ACCOUNT_PK" PRIMARY KEY ("ACCT_ID") USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1 FREELIST GROUPS 1) TABLESPACE "WMC_DATA" LOGGING ENABLE Look for... (1 Reply)
Discussion started by: rajan_san
1 Replies

4. Shell Programming and Scripting

Simple egrep pattern

I'm new to egrep. What pattern could I use to find all lines that match this pattern: <beginning of line><any amount of whitespace>sub<space>. I want it to return the entire line. (I'm trying to generate a list of all Perl sub definitions in a list of Perl modules.) Thanks for your help! (7 Replies)
Discussion started by: blondie53403
7 Replies

5. Shell Programming and Scripting

grep/egrep end of pattern

Hi I use arp to get the mac-addresses of my hosts. # arp -a | grep 192.168.0. e1000g0 192.168.0.1 255.255.255.255 o 00:00:00:00:00:01 e1000g0 192.168.0.11 255.255.255.255 o 00:00:00:00:00:02 e1000g0 192.168.0.2 255.255.255.255 ... (12 Replies)
Discussion started by: domi55
12 Replies

6. Shell Programming and Scripting

How to egrep multiple pattern

Hi everyone i want to write a script to grep multiple pattern from all the file from a dir. for example I want to get all the record number from XML file who's last name is asd, smith, dfrt,gokul,and sinha. I tried egrep('sinha'|'gokul'|'asd') but it is not working also i tried saving... (2 Replies)
Discussion started by: revertback
2 Replies

7. Shell Programming and Scripting

egrep - Help Required

HI, I have a piece of code which checks the return value for a pattern "Status: 0000" like this - returnval=<<some op>> echo $returnval | egrep "\bStatus:\s+" if ; then echo "Failed" fi Even on success or failure i get $? = 1 i.e. it never passes ? (16 Replies)
Discussion started by: angshuman_ag
16 Replies

8. Shell Programming and Scripting

Find required files by pattern in xml files and the change the pattern on Linux

Hello, I need to find all *.xml files that matched by pattern on Linux. I need to have written the file name on the screen and then change the pattern in the file just was found. For instance. I can start the script with arguments for keyword and for value, i.e script.sh keyword... (1 Reply)
Discussion started by: yart
1 Replies

9. Shell Programming and Scripting

Help required to find pattern

Hi All, I have a oracle code & want to exclude the comments present in the code. Below may be the pattern can be considered for eg. -- ALTER TABLE ALTER TABLE -- To create In above sample, First line is full commented line as it starts with "--" Wheras the second line is starting... (2 Replies)
Discussion started by: gr8_usk
2 Replies

10. Shell Programming and Scripting

EGREP pattern advice

Hi, I need advice on a simiple pattern check, Orginal Code bpimagelist -backupid xxxxxxxxxxxxx | grep "FRAG " | egrep -i "C5|W5" | awk 'NR==1{print $2,$9} 1 MAC514 What i want is to find any media beinging with C5|W5. I have tried ^C5|^W5, but this does not work. Removed... (3 Replies)
Discussion started by: Junes
3 Replies
BZGREP(1)						      General Commands Manual							 BZGREP(1)

NAME
bzgrep, bzfgrep, bzegrep - search possibly bzip2 compressed files for a regular expression SYNOPSIS
bzgrep [ grep_options ] [ -e ] pattern filename... bzegrep [ egrep_options ] [ -e ] pattern filename... bzfgrep [ fgrep_options ] [ -e ] pattern filename... DESCRIPTION
Bzgrep is used to invoke the grep on bzip2-compressed files. All 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 bzgrep is invoked as bzegrep or bzfgrep then egrep or fgrep is used instead of grep. If the GREP environment variable is set, bzgrep uses it as the grep program to be invoked. For example: for sh: GREP=fgrep bzgrep string files for csh: (setenv GREP fgrep; bzgrep string files) AUTHOR
Charles Levert (charles@comm.polymtl.ca). Adapted to bzip2 by Philippe Troin <phil@fifi.org> for Debian GNU/Linux. SEE ALSO
grep(1), egrep(1), fgrep(1), bzdiff(1), bzmore(1), bzless(1), bzip2(1) BZGREP(1)
All times are GMT -4. The time now is 12:04 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy