LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 10-04-2005, 02:42 PM   #16
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669

FYI: I wasn't trying to start a flame war either. As pointed out in my prior post I haven't really bothered to learn bash because I'm comfortable with ksh and use it on my other *Nixes.

That said: I can't resisting pointing out that "/" is one keystroke whereas "ctrl-r" is two.




P.S. REAL hackers use buffer overflows and don't ever bother with shells.

Last edited by MensaWater; 10-04-2005 at 02:43 PM.
 
Old 08-14-2015, 05:07 AM   #17
ramin1981
LQ Newbie
 
Registered: Feb 2013
Posts: 11

Rep: Reputation: Disabled
Quote:
Originally Posted by Melsync View Post
And it does

rm `ls | grep -v "xml\|mpeg"`

as well!
And how add another extensions for example .sh?
I tried rm `ls | grep -v "xml\|mpeg\|sh"` - but failed
on rm `ls | grep -v "xml\|mpeg"` - what is function of "" after xml
Thanks in advance!
 
Old 08-14-2015, 06:16 AM   #18
HMW
Member
 
Registered: Aug 2013
Location: Sweden
Distribution: Debian, Arch, Red Hat, CentOS
Posts: 773
Blog Entries: 3

Rep: Reputation: 369Reputation: 369Reputation: 369Reputation: 369
Quote:
Originally Posted by ramin1981 View Post
And how add another extensions for example .sh?
I tried rm `ls | grep -v "xml\|mpeg\|sh"` - but failed
on rm `ls | grep -v "xml\|mpeg"` - what is function of "" after xml
Thanks in advance!

(Blimey, this is an old thread!!!)


Umm... I don't know why you can't get it to work. It works fine for me:
Code:
$ ls
framework_116.php  functions_116.php  get-pip.py       lqsed.txt    read_sed.sh
framework_117.php  functions_117.php  health_logs.txt  newfile.txt  regex.html
Code:
$ ls | grep -v 'txt\|sh\|php'
get-pip.py
regex.html
If you use it in a loop in a script, check if you have spaces in the file name. Common pitfall. Read more here:
http://mywiki.wooledge.org/ParsingLs
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Complex cp : only *.jpg files while excluding DIRs LancerNZ Linux - General 3 02-16-2005 04:12 AM
files with extensions ;type=i santoshraju Linux - General 2 12-11-2004 11:31 AM
Excluding directories from zip files jonathanztaub Linux - General 1 05-17-2004 03:17 AM
file extensions ? types ? executable files ?? abbasakhtar Linux - Newbie 13 10-06-2003 06:12 PM
tar and excluding files murshed Linux - Newbie 7 03-15-2003 03:32 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:01 AM.

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