LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-04-2007, 01:36 PM   #1
SirTristan
Member
 
Registered: Feb 2006
Distribution: GNU/Linux
Posts: 54

Rep: Reputation: 15
Linux Boolean Not operator?


What's the Boolean Not operator for Linux? For instance for use with 'ls', like the opposite of 'ls *.html' - I tried 'ls !*.html' but that doesn't work.
 
Old 12-04-2007, 02:23 PM   #2
forrestt
Senior Member
 
Registered: Mar 2004
Location: Cary, NC, USA
Distribution: Fedora, Kubuntu, RedHat, CentOS, SuSe
Posts: 1,288

Rep: Reputation: 99
It doesn't work that way. However, you can run:

Code:
ls | grep -v \.html\$
and get the answer you are looking for.

This will send the ls output to the grep command. The parameters for grep tell grep to return all lines that do not (the -v) end (the $) with ".html". the "." and the "$" must be escaped so the shell doesn't try to expand them before they are send to the grep command.

HTH

Forrest
 
Old 12-04-2007, 05:11 PM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,358

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
I'd just go with
ls |grep -v '.html'
unless you've got some funky filenames, but forestt's soln is stricter if you have.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
boolean question! xemous General 3 03-18-2005 03:40 AM
Linux operator Orinoco gold, Can see wlan's cannot surf nepcw Linux - Wireless Networking 10 03-14-2005 10:49 PM
unknown boolean httpd_tty_comm philio Fedora 2 02-06-2005 09:48 AM
Unknown boolean error mebrelith Fedora 4 01-24-2005 03:47 AM
C++ boolean in cout statement AMMullan Programming 2 06-08-2004 12:44 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:50 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration