Sponsored Content
Top Forums Shell Programming and Scripting Removing multiple lines from input file, if multiple lines match a pattern. Post 302956236 by zaxxon on Monday 28th of September 2015 09:36:10 AM
Old 09-28-2015
Not sure if I understood it exactly - did you try something like:
Code:
grep -vE "abc|def|ghi|jkl" infile
# or more precise
grep -vE "^(abc|def|ghi|jkl)$" infile

? Should the file be edited in place or is a temp file ok?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Concatenating multiple lines to one line if match pattern

Hi all, I've been working on a script which I have hit a road block now. I have written a script using sed to extract the below data and pumped into another file: Severity............: MAJORWARNING Summary: System temperature is out of normal range. Severity............: MAJORWARNING... (13 Replies)
Discussion started by: phixsius
13 Replies

2. Shell Programming and Scripting

removing pattern which is spread in multiple lines

I have several huge files wich contains oracle table creation scripts as follows: I would need to remove the pattern colored in red above. Any sed/awk/pearl code will be of much help. Thanks (2 Replies)
Discussion started by: sabyasm
2 Replies

3. UNIX for Dummies Questions & Answers

removing multiple lines of text in a file

Hi, I'm trying to remove multiple lines of text based off a series of different words and output it to a new file The document contains a ton of data but i want to delete any line that has the following mx1.rr.biz.com or ns2.ri.biz.com i tried using grep -v filename "mx1.rr.biz.com" >... (3 Replies)
Discussion started by: spartan22
3 Replies

4. Shell Programming and Scripting

Perl: Printing Multiple Lines after pattern match

Hello People, Need some assistance/guidance. OUTLINE: Two files (File1 and File2) File1 has some ids such as 009463_3922_1827 897654_8764_5432 File2 has things along the lines of: Query= 009463_3922_1827 length=252 (252 letters) More stufff here ... (5 Replies)
Discussion started by: Deep9000
5 Replies

5. Shell Programming and Scripting

shell script: grep multiple lines after pattern match

I have sql file containing lot of queries on different database table. I have to filter specific table queries. Let say i need all queries of test1,test2,test3 along with four lines above it and sql queries can be multi lines or in single line. Input file contains. set INSERT_ID=1; set... (1 Reply)
Discussion started by: mirfan
1 Replies

6. Shell Programming and Scripting

Awk match multiple columns in multiple lines in single file

Hi, Input 7488 7389 chr1.fa chr1.fa 3546 9887 chr5.fa chr9.fa 7387 7898 chrX.fa chr3.fa 7488 7389 chr21.fa chr3.fa 7488 7389 chr1.fa chr1.fa 3546 9887 chr9.fa chr5.fa 7898 7387 chrX.fa chr3.fa Desired Output 7488 7389 chr1.fa chr1.fa 2 3546 9887 chr5.fa chr9.fa 2... (2 Replies)
Discussion started by: jacobs.smith
2 Replies

7. Shell Programming and Scripting

Extract a pattern from multiple lines in a file

I have a file that has some lines starts with * I want to get these lines, then get the word between "diac" and "lex". ex. file: ;;WORD AlAx *0.942490 diac:Al>ax lex:>ax_1 bw:Al/DET+>ax/NOUN+ gloss:brother pos:noun prc3:0 prc2:0 prc1:0 prc0:Al_det per:na asp:na vox:na mod:na gen:m num:s... (4 Replies)
Discussion started by: Viernes
4 Replies

8. Shell Programming and Scripting

Match Pattern and print pattern and multiple lines into one line

Hello Experts , require help . See below output: File inputs ------------------------------------------ Server Host = mike id rl images allocated last updated density vimages expiration last read <------- STATUS ------->... (4 Replies)
Discussion started by: tigerhills
4 Replies

9. Shell Programming and Scripting

Remove multiple lines that match pattern

Not sure how I can accomplish this. I would like to remove all interfaces that have the commands I would like to see: switchport port-security, spanning-tree portfast. One line is no problem. interface FastEthernet0/8 spanning-tree portfast interface FastEthernet0/9 spanning-tree... (4 Replies)
Discussion started by: mrlayance
4 Replies

10. Shell Programming and Scripting

Removing carriage returns from multiple lines in multiple files of different number of columns

Hello Gurus, I have a multiple pipe separated files which have records going over multiple Lines. End of line separator is \n and records going over multiple lines have <CR> as separator. below is example from one file. 1|ABC DEF|100|10 2|PQ RS T|200|20 3| UVWXYZ|300|30 4| GHIJKL|400|40... (7 Replies)
Discussion started by: dJHa
7 Replies
ECACCESS-EVENT-GRANT(1p)				User Contributed Perl Documentation				  ECACCESS-EVENT-GRANT(1p)

NAME
ecaccess-event-grant - Grant usage of an ECaccess Event SYNOPSIS
ecaccess-event-grant -version|-help|-manual ecaccess-event-grant [-debug] [-subscribe] [-notify] event-id user-list DESCRIPTION
Allow managing the Event permissions for a list of user(s). The permissions can be either subscribe, notify, both or none. In order to remove permissions to an Event for a list of users use this command with no -subscribe and -notify options. ARGUMENTS
event-id The identifier of the Event to grant. user-list The user(s) to give/remove the permissions. Multiple users should be separated by a column (e.g. abc,def). OPTIONS
-subscribe The user(s) specified in the user-list will be allowed to subscribe to the event-id (e.g. with the -eventIds option of the ecaccess-job-submit command). -notify The user(s) specified in the user-list will be allowed to send notifications to the event-id (e.g. with the ecaccess-event-send command). -version Display version number and exits. -help Print a brief help message and exits. -manual Prints the manual page and exits. -debug Display the SOAP messages exchanged. EXAMPLES
ecaccess-event-grant -subscribe 167 abc,def,jhi Allow the users abc, def and jhi to subscribe to this Event. ecaccess-event-grant 167 jkl Remove all rights to the Event for the user jkl. SEE ALSO
ecaccess-event-clear, ecaccess-event-delete, ecaccess-event-send, ecaccess-event-list, ecaccess-event-create and ecaccess. perl v5.14.2 2012-04-16 ECACCESS-EVENT-GRANT(1p)
All times are GMT -4. The time now is 02:20 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy