Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Grep -v lines starting with pattern 1 and not matching pattern 2 Post 302949697 by neutronscott on Tuesday 14th of July 2015 04:12:17 PM
Old 07-14-2015
I believe awk would be easier. Your logic would be ! ( /^Eat/ && ! /apple/), or, following De Morgan's law:

Code:
$ awk '! /^Eat/ || /apple/' input
Drink a soda
Drink an apple juice
Eat an apple
Eat multiple apples

or if it really has to be grep:

Code:
mute@tiny:~$ grep -e '^[^E][^a][^t]' -e apple input
Drink a soda
Drink an apple juice
Eat an apple
Eat multiple apples

These 2 Users Gave Thanks to neutronscott For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

comment/delete a particular pattern starting from second line of the matching pattern

Hi, I have file 1.txt with following entries as shown: 0152364|134444|10.20.30.40|015236433 0233654|122555|10.20.30.50|023365433 ** ** ** In file 2.txt I have the following entries as shown: 0152364|134444|10.20.30.40|015236433 0233654|122555|10.20.30.50|023365433... (4 Replies)
Discussion started by: imas
4 Replies

2. Shell Programming and Scripting

counting the lines matching a pattern, in between two pattern, and generate a tab

Hi all, I'm looking for some help. I have a file (very long) that is organized like below: >Cluster 0 0 283nt, >01_FRYJ6ZM12HMXZS... at +/99% 1 279nt, >01_FRYJ6ZM12HN12A... at +/99% 2 281nt, >01_FRYJ6ZM12HM4TS... at +/99% 3 283nt, >01_FRYJ6ZM12HM946... at +/99% 4 279nt,... (4 Replies)
Discussion started by: d.chauliac
4 Replies

3. Shell Programming and Scripting

Concatenate lines between lines starting with a specific pattern

Hi, I have a file such as: --- >contig00001 length=35524 numreads=2944 gACGCCGCGCGCCGCGGCCAGGGCTGGCCCA CAGGCCGCGCGGCGTCGGCTGGCTGAG >contig00002 length=4242 numreads=43423 ATGCCGAAGGTCCGCCTGGGGCTGG CGCCGGGAGCATGTAGCG --- I would like to concatenate the lines not starting with ">"... (9 Replies)
Discussion started by: s052866
9 Replies

4. Shell Programming and Scripting

delete lines starting with a pattern

i have a file sample.txt containing i want to delete lines starting with 123 neglecting spaces and tabs. but not lines containing 123. i.e. i want files sample.txt as help me thanxx (4 Replies)
Discussion started by: yashwantkumar
4 Replies

5. Shell Programming and Scripting

Grep the word from pattern line and update in subsequent lines till next pattern line reached

Hi, I have got the below requirement. please suggest. I have a file like, Processing Item is: /data/ing/cfg2/abc.txt /data/ing/cfg3/bgc.txt Processing Item is: /data/cmd/for2/ght.txt /data/kernal/config.klgt.txt I want to process the above file to get the output file like, ... (5 Replies)
Discussion started by: rbalaj16
5 Replies

6. Shell Programming and Scripting

Sed: printing lines AFTER pattern matching EXCLUDING the line containing the pattern

'Hi I'm using the following code to extract the lines(and redirect them to a txt file) after the pattern match. But the output is inclusive of the line with pattern match. Which option is to be used to exclude the line containing the pattern? sed -n '/Conn.*User/,$p' > consumers.txt (11 Replies)
Discussion started by: essem
11 Replies

7. Shell Programming and Scripting

sed and awk usage to grep a pattern 1 and with reference to this grep a pattern 2 and pattern 3

Hi , I have a file where i have modifed certain things compared to original file . The difference of the original file and modified file is as follows. # diff mir_lex.c.modified mir_lex.c.orig 3209c3209 < if(yy_current_buffer -> yy_is_our_buffer == 0) { --- >... (5 Replies)
Discussion started by: breezevinay
5 Replies

8. Shell Programming and Scripting

Grep lines before a pattern having some other pattern

Hi All, I am trying to fetch lines before a pattern, I got to know about -B flag in grep but we have to pass the number to get those lines before some pattern say (X), now what if I want to get line/s with some other pattern say (Y) before X pattern? How to get about it? please help. Input:... (5 Replies)
Discussion started by: dips_ag
5 Replies

9. Shell Programming and Scripting

sed -- Find pattern -- print remainder -- plus lines up to pattern -- Minus pattern

The intended result should be : PDF converters 'empty line' gpdftext and pdftotext?xml version="1.0"?> xml:space="preserve"><note-content version="0.1" xmlns:/tomboy/link" xmlns:size="http://beatniksoftware.com/tomboy/size">PDF converters gpdftext and pdftotext</note-content>... (9 Replies)
Discussion started by: Klasform
9 Replies

10. UNIX for Beginners Questions & Answers

Grep file starting from pattern matching line

I have a file with a list of references towards the end and want to apply a grep for some string. text .... @unnumbered References @sp 1 @paragraphindent 0 2017. @strong{Chalenski, D.A.}; Wang, K.; Tatanova, Maria; Lopez, Jorge L.; Hatchell, P.; Dutta, P.; @strong{Small airgun... (1 Reply)
Discussion started by: kristinu
1 Replies
gss(5)							      BSD File Formats Manual							    gss(5)

NAME
gss -- how to configure gss framework DESCRIPTION
The gss GSS.frameworks have several configuration domains, all can configured with defaults(1). Configuration can be stored both in the user's configuration ( ~/Library/Preferences) and system ( /Library/Preferences ). CONFIGURATION OPTIONS
Use gsstool(1) to list the supported options and their settings: gsstool supported-mech --options Common options are: NTLM 'Force NTLMv1' Force client to use NTLMv1 NTLM NTLMv1 Enable support for NTLMv1 in both client and server NTLM NTLMv2 Enable support for NTLMv2 in both client and server NTLM 'NTLM session key' Require backends to support for NTLMv2 session key, Lion and earlier dont support this. Session keys is required for NTLM MIC that stops reflection attacks. NTLM 'AllowedHosts' What hosts that NTLM is allowed to be used for. When there a host that is not on the list, NTLM will not be used. File globbing is used when matching and it's case insensitive. When there is no configuration, all hosts are allowed. defaults write com.apple.GSS.NTLM AllowedHosts -array host.local '*.my.domain' NTLM options If you want to disable NTLM support completely in both the acceptor (server) and initiator (client), you need disable both NTLMv1 and NTLMv2, and set their values to boolean false or 0. defaults write com.apple.GSS.NTLM NTLMv1 -bool false defaults write com.apple.GSS.NTLM NTLMv2 -bool false APPLE MAC OS X
You can use the defaults write command to change the options, for simple boolean options, use this: defaults write com.apple.GSS.NTLM NTLMv1 -bool false You can also turn on debugging (output in syslog) using: defaults write com.apple.GSS DebugLevel -int 10 open -a Console SEE ALSO
defaults(1), gss_mo(3), heimdal_debug(1) HEIMDAL
Sep 1, 2010 HEIMDAL
All times are GMT -4. The time now is 01:23 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy