Hello, everyone!
I would appreciate any input or advice on the following quite simple
issue:
If I search through a file list using grep -E '.*[^(JPG|png)]$' it will
not pull files ending in JPG and files ending in png which is fine.
However, I have some files ending in jpg (note - lower case) and it
will not display them either. Why is that? Am I doing something wrong
here and if so - what?
It obviously is a regexp issue and not a grep issue because I tried
this in vim and it acts the same way.
Any advice would be greatly appreciated.
Thanks,
Roumen. 4 8683 se*****@concord .edu wrote: Hello, everyone! I would appreciate any input or advice on the following quite simple issue: If I search through a file list using grep -E '.*[^(JPG|png)]$' it
will not pull files ending in JPG and files ending in png which is fine. However, I have some files ending in jpg (note - lower case) and it will not display them either. Why is that? Am I doing something wrong here and if so - what?
SNIP
The regexp you specified says the following:
any single character - 0 or more times, followed by
any single character from the set of characters between
the square brackets that is NOT an open paren, or J,
or P, or G, or |, or p, or n, or g, or close paren,
followed by an end-of-line.
I think what you want is:
egrep -iv 'JPG$|png$'
--
Dana French - Mt Xia df*****@mtxia.c om
Mt Xia Technical Consulting Group http://www.mtxia.com
Ridmail - 100% Spam Free Email http://www.ridmail.com
MicroEMACS Binaries http://uemacs.tripod.com
Korn Shell Web http://dfrench.tripod.com
<se*****@concor d.edu> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.com.. . Hello, everyone! I would appreciate any input or advice on the following quite simple issue: If I search through a file list using grep -E '.*[^(JPG|png)]$' it will not pull files ending in JPG and files ending in png which is fine. However, I have some files ending in jpg (note - lower case) and it will not display them either. Why is that? Am I doing something wrong here and if so - what? It obviously is a regexp issue and not a grep issue because I tried this in vim and it acts the same way. Any advice would be greatly appreciated.
Probably because you're not doing what you think you're doing. You're
creating a negated *character class* and checking for files that don't end
with one of those characters. You're not looking for files that don't end in
JPG or png, even though that might seem to be working. And since .jpg end
with "g"...
Since you're not asking a Perl question, I'll leave it to you to make it
work for grep.
Matt
Matt Garrish wrote: <se*****@concor d.edu> wrote in message news:11******** **************@ f14g2000cwb.goo glegroups.com.. . Hello, everyone! I would appreciate any input or advice on the following quite
simple issue: If I search through a file list using grep -E '.*[^(JPG|png)]$' it
will not pull files ending in JPG and files ending in png which is fine. However, I have some files ending in jpg (note - lower case) and it will not display them either. Why is that? Am I doing something
wrong here and if so - what? It obviously is a regexp issue and not a grep issue because I tried this in vim and it acts the same way. Any advice would be greatly appreciated.
Probably because you're not doing what you think you're doing. You're
creating a negated *character class* and checking for files that
don't end with one of those characters. You're not looking for files that don't
end in JPG or png, even though that might seem to be working. And since .jpg
end with "g"...
Since you're not asking a Perl question, I'll leave it to you to make
it work for grep.
Matt
**
You are right, It is a regex issue.
to search for a *.jpg and *.png try
grep *.[jp][pn]g
to include search for upper and lower case in the extension:
grep *.[JjPp][PpNn][Gg]
Walt R.
** wm********@tns. net wrote: You are right, It is a regex issue.
to search for a *.jpg and *.png try
grep *.[jp][pn]g
Are you sure you want to include *.jng and *.ppg in your list of matching
file extensions, too?
to include search for upper and lower case in the extension: grep *.[JjPp][PpNn][Gg]
I would rather use the /i option.
From "perldoc perlop":
Options are:
[...]
i Do case-insensitive pattern matching.
jue This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Toffe |
last post by:
Hi,
I've got a problem with regular expressions and strings containing
Swedish characters (åäö).
I basically have a PHP script that highlights certain words in a text. I
found the code attached below in the commented manual at php.net. It
works great for all words that do not contain Swedish characters. The
words that do contain åäö will not be highlighted.
|
by: Kenneth McDonald |
last post by:
I'm working on the 0.8 release of my 'rex' module, and would appreciate
feedback, suggestions, and criticism as I work towards finalizing the
API and feature sets. rex is a module intended to make regular expressions
easier to create and use (and in my experience as a regular expression
user, it makes them MUCH easier to create and use.)
I'm still working on formal documentation, and in any case, such
documentation isn't necessarily the...
|
by: Rajeev Soni |
last post by:
Hi
I am looking for the regular expression for validating the allowed file types to upload like files like "zip,pdf,doc,rtf,gif,jpg,png,txt"; and the expression should not be case sensitive like it must match ZIP | zip | zIp.....
regards
rajeev
|
by: vvenk |
last post by:
Hello:
I am trying to learn about regular expressions.
How would I use regular expressions to ensure that the password an user
enters conforms to the following rules:
1. It has to be between 3-20 characters long.
2. Only a-z, A-Z, 0-9, +-_ are allowed.
3. At least one occurence of a lower case letter, a upper case letter and a
|
by: gimme_this_gimme_that |
last post by:
What is the regular expression that checks that every character in a
string is in ?
Thanks.
| |
by: Franky |
last post by:
This should be easy to find but I've been looking and looking at the doc and
can't find it. Maybe it can't be done.
In the IDE editors find/replace I want to use regular expression to change
the first letter after "Dim " to lower case.
e.g Dim Tmp to Dim tmp
can you show me the replace string.
|
by: Chris |
last post by:
I want to ensure a password has a least one lower case letter, one upper
letter and a number. I'm a bit of a newbie but I understand you can use the
pipe system for OR what about AND.I would like something like this.
&&
|
by: Lit |
last post by:
Hi,
I am looking for a Regular expression for a password for my RegExp
ValidationControl
Requirements are,
At least 8 characters long.
At least one digit
At least one upper case character
|
by: AAaron123 |
last post by:
I found this on the Internet and tried a few of them and they worked in
VS2008.
Actually it was in a different form but I converted to make a smaller file.
The data is the same as the original.
I'm confused about how regular expressions work in different systems.
I suspect that each system may have some things that do not work in other
systems.
So my question is: Do the things in the table below work on VS2008?
And what is Posix and...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |