![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Regex | pppswing | Shell Programming and Scripting | 5 | 06-30-2008 11:22 PM |
| A simple find and replace without using any regex (bash) | srikanths | Shell Programming and Scripting | 2 | 03-18-2008 08:08 AM |
| Regex | deepakpv | Shell Programming and Scripting | 6 | 03-28-2007 05:18 AM |
| Regex?? Please help | lunac | UNIX for Dummies Questions & Answers | 7 | 01-30-2007 01:13 PM |
| sed regex | Shakey21 | UNIX for Dummies Questions & Answers | 4 | 01-31-2002 09:16 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Assuming you want an answer rather than a theory, something like
Code:
for f in *; do grep use "$f" >/dev/null && continue grep take "$f" >/dev/null && continue # file contains neither if we get to here; report its file name echo "$f" done |
|
||||
|
From the top of my head, I would use something like
Code:
grep -L use $(grep -L take *.txt) But I'm sure there is a way to use OR in the regexp.. /Lakris |
|
||||
|
Use egrep, search for $var1 OR $var2:
Code:
egrep "[$var1]|[$var2]" file Code:
egrep -v "[$var1]|[$var2]" file Code:
egrep "$var1.*$var2|$var2.*$var1" file Code:
egrep -v "$var1.*$var2|$var2.*$var1" file Last edited by Franklin52; 08-31-2008 at 07:29 AM.. Reason: Adding invert match |
|
||||
|
Quote:
, I have to read the question thoroughly.Regards |
|
||||
|
useless use of cat?
I guess I misinterpreted the OP, now here is my supersilly superuseless use of cat and pipe...
Code:
for x in *.txt;do cat $x|tr "\n" " "|egrep '(use.*take|take.*use)'&>/dev/null; [ $? == 1 ] && echo $x;done /Lakris |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|