Computing.Net > Forums > Unix > How to negate a regexp with 'ls'

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Click here to start participating now! Also, check out the New User Guide.

How to negate a regexp with 'ls'

Reply to Message Icon

Name: goflyboy
Date: August 4, 2005 at 20:23:08 Pacific
OS: Windows XP
CPU/Ram: AMD 2Ghz / 1Gb
Comment:

I need to negate a regular expression using a syntax compatible with the 'ls' command (That is, I can not use awk, sed, grep, or perl).

Example: Let's say I want to return a list of all filenames that are not named "MYFILE".

Background: Actually, I need to use this command with Matlab's "clear" command to wipe out all variables except for one or two counters I need to preserve.

Thanks for your suggestions.
-Dan.



Sponsored Link
Ads by Google

Response Number 1
Name: Jim Boothe
Date: August 5, 2005 at 06:46:33 Pacific
Reply:

ls -d !(MYFILE)

ls -d !(MYFILE*)


0
Reply to Message Icon

Related Posts

See More


out parameter to shell complicated problem



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: How to negate a regexp with 'ls'

how to create a beep sound www.computing.net/answers/unix/how-to-create-a-beep-sound/6312.html

How to delete a file named -x www.computing.net/answers/unix/how-to-delete-a-file-named-x/3350.html

how to write a shellscript sleep www.computing.net/answers/unix/how-to-write-a-shellscript-sleep/5528.html