LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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 08-08-2017, 11:49 AM   #1
TBotNik
Member
 
Registered: May 2016
Location: Greenville, TX
Distribution: Kubuntu 18.04
Posts: 796

Rep: Reputation: Disabled
Filter not working


All,

I'm running the cmd:
Code:
locate -i notes | grep -i dropbox --exclude-dir=[\*ProJects*\} | grep \.doc > /home/files/notes_dump.txt && gedit /home/files/notes_dump.txt
but always still have the "ProJects" directory showing in the results.

What is not right with my grep statement?

Thanks!

TBNK
 
Old 08-08-2017, 12:12 PM   #2
TheEzekielProject
Member
 
Registered: Dec 2016
Distribution: arch
Posts: 668

Rep: Reputation: 190Reputation: 190
Code:
--exclude-dir=[\*ProJects*\}
You have different brackets
 
Old 08-15-2017, 10:42 AM   #3
TBotNik
Member
 
Registered: May 2016
Location: Greenville, TX
Distribution: Kubuntu 18.04
Posts: 796

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by TheEzekielProject View Post
Code:
--exclude-dir=[\*ProJects*\}
You have different brackets
TheEzekielProject,

Thanks for the bracket check, but still getting this/these directories in the output:

Code:
/home/files/Dropbox/ProJects/Web/External Projects/
Do I need to use REGEX instead? It seems to work better when the dir you are filtering out is in the middle of the dir string. Am I right?

So what is The Ezekiel Project?

Cheers!

TBNK

Last edited by TBotNik; 08-15-2017 at 10:44 AM.
 
Old 08-30-2017, 02:00 PM   #4
TBotNik
Member
 
Registered: May 2016
Location: Greenville, TX
Distribution: Kubuntu 18.04
Posts: 796

Original Poster
Rep: Reputation: Disabled
Can I get some help here?
 
Old 09-04-2017, 06:23 PM   #5
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
I think the problem is that the o/p of 'locate' is effectively a bunch of strings (as opposed to eg grep -r , which is actually reading the dir nodes content ).

Try using 'grep -v' or even 'egrep -v' on the 'locate' o/p.

HTH
 
Old 09-05-2017, 12:55 AM   #6
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
don't use locate for changing, user created content.
also, since you are piping locate's output to grep, i don't think the --exclude-dir option makes any sense there.

please explain what you are trying to achieve, we will help you formulate a better command.
 
Old 09-05-2017, 02:55 AM   #7
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,838

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
You did not tell us how did you fix that problem in post #2. So how can we go further?
 
Old 05-03-2020, 11:44 AM   #8
TBotNik
Member
 
Registered: May 2016
Location: Greenville, TX
Distribution: Kubuntu 18.04
Posts: 796

Original Poster
Rep: Reputation: Disabled
Followup

All,

Following up on all my open threads, looking to close/solve them all.

Cheers!

TBNK
 
Old 05-04-2020, 07:27 AM   #9
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,925
Blog Entries: 44

Rep: Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159
Moderator Response

Do not bump necro threads unless you have relative content as OP;
Quote:
LQ Rules Do not post if you do not have anything constructive to say in the post.
 
1 members found this post helpful.
Old 05-08-2020, 01:14 AM   #10
JJJCR
Senior Member
 
Registered: Apr 2010
Posts: 2,150

Rep: Reputation: 449Reputation: 449Reputation: 449Reputation: 449Reputation: 449
Quote:
/home/files/Dropbox/ProJects/Web/External Projects/
Quote:
--exclude-dir=[\*ProJects*\}
Both are different "ProJects" and "Projects" in the context of case sensitivity.

You can try:

Quote:
grep -i -r dropbox --exclude-dir=[\*Pro?ects*\]


-r = for recursive search

Good luck!

Last edited by JJJCR; 05-08-2020 at 01:15 AM. Reason: edit
 
Old 05-08-2020, 02:26 AM   #11
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,838

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
this is completely wrong.
--exlcude-dir has only any effect if you use recursive search (grep -r), not when grepping stdin.
From the other hand grep -v <pattern> may work (as it was already suggested).

Quote:
Originally Posted by TBotNik View Post
All,

Following up on all my open threads, looking to close/solve them all.
Yes, I would like to see a follow up from you. If it was still a problem for you, if you have already tried any suggestion posted.
 
1 members found this post helpful.
Old 06-08-2020, 12:16 PM   #12
TBotNik
Member
 
Registered: May 2016
Location: Greenville, TX
Distribution: Kubuntu 18.04
Posts: 796

Original Poster
Rep: Reputation: Disabled
All,

As a KDE user, I normally use "KFind" which searches the entire system including any flash drives active, but kfind sometimes blows on install, so not always available.

Both "find" and "locate" are limited to the "/home" directory!

What is needed is a command line equivalent of "kfind" that will search the entire system by default.

I'll try to find the right board to post this one so the OS level gurus will create the right command for this!

If anyone has a bash script that equals "kfind"; I'll go ahead and mark this solved. Please share if you have such a script!

Cheers!

TBNK
 
Old 06-08-2020, 01:12 PM   #13
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,727

Rep: Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211
Quote:
Originally Posted by TBotNik View Post
All,

Following up on all my open threads, looking to close/solve them all.

Cheers!

TBNK
To mark a thread [SOLVED], use the Thread tools at the top of the thread. There is no need to also post.
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] File filter in gpicview (based on gdk-pixbuf) not working correctly hazel Linux - Desktop 1 03-09-2017 06:32 AM
TCPDUMP Filter not working Kgeil Linux - Networking 1 03-07-2014 11:43 AM
Spam Filter stopped working in Evolution 2.6.0 nuro305 SUSE / openSUSE 0 12-18-2007 10:03 PM
evolution filter is not working feetyouwell Linux - Software 0 01-07-2005 09:50 AM
iptables not working... can't initialize 'filter' PennyroyalFrog Linux - Newbie 2 11-24-2004 10:03 PM

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

All times are GMT -5. The time now is 12:33 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