Using Grep Include/Exclude Files


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Using Grep Include/Exclude Files
# 8  
Old 10-28-2011
Try this for excluding the hidden files...
Code:
find /home ! -path "*/\.*"

--ahamed
This User Gave Thanks to ahamed101 For This Post:
# 9  
Old 10-28-2011
this worked:

Code:
find /home \( ! -regex '.*/\..*' \) -type f -name "*"

but it would be nice to just use the exclude file for this stuff.

---------- Post updated at 01:03 AM ---------- Previous update was at 12:58 AM ----------

wow to easy. good stuff. I just attempted to add that to my exclude file using grep and it didnt work. There is some trick to the format in this exclude file that would make this alot easier. Regardless many thanksSmilie

---------- Post updated at 01:08 AM ---------- Previous update was at 01:03 AM ----------

this seem to have worked:

Code:
sudo find /home -depth -mtime 0 ! -path "*/\.*" -print | grep -f include_home | grep -v -f exclude_home

I still have this itch with the exclude file. I need to dig a little further into that for it would make things easier.

regards

Last edited by metallica1973; 10-28-2011 at 12:08 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Exclude multiple lines using grep

Hi, I'm working on a shell script that reports service status on a database server. There are some services that are in disabled status that the script should ignore and only check the services that are in Enabled status. I output the service configuration to a file and use that information to... (5 Replies)
Discussion started by: senthil3d
5 Replies

2. Shell Programming and Scripting

Rsync exclude & include?

hi I have a few folders and a few files , for example Directory A B C D E Files 1 2 3 4 5 I want B directory and "2" File that does not sync But other directories and file sync What is the solution ? Is there a way to sync time is under one minute? os centos 6.8 thanks... (5 Replies)
Discussion started by: mnnn
5 Replies

3. Shell Programming and Scripting

Include information in certain columns using grep and awk

HI all, I have data in a file that looks like this: 1 HOW _ NNP NNP _ 3 nn _ _ 2 DRUGS _ NNP NNP _ 3 nn _ _ 3 ACT _ NNP NNP _ 0 null _ _ 4 : _ ... (3 Replies)
Discussion started by: owwow14
3 Replies

4. UNIX for Dummies Questions & Answers

Is there a good way to grep multiple directories without --include?

Hello. I consider myself a journeyman Unix user. I can handle most day to day tasks and have created some fairly complicated command queries, but this problem has defeated me so far. Any help would be greatly appreciated! We keep an archive in the file system with a directory structure in... (5 Replies)
Discussion started by: pauliesyllabic
5 Replies

5. Red Hat

SFTP user include/exclude without preventing SSH login

I have been asked to see if we can restrict SFTP access to authorised users only. There will be business users who will log on with SSH, but they are locked into a menu. They will have write access to the production data to do their job, but we don't want them to have access to read/write the... (8 Replies)
Discussion started by: rbatte1
8 Replies

6. Shell Programming and Scripting

Exclude dash in grep

Hi, I must be overlooking something, but I don't understand why this doesn't work. I'm trying to grep on a date, excluding all the lines starting with a dash: testfile: #2013-12-31 2013-12-31code: grep '^2013-12-31' testfileI'm expecting to see just the second line '2013-12-31' but I don't... (3 Replies)
Discussion started by: Subbeh
3 Replies

7. Shell Programming and Scripting

Grep for a srting & exclude two folders

Hi, Below is the command to grep for a string under grep -r "redeem" /home/tom Need to make it case insensitive and exclude logs & tmp folders under /home/tom directory in my Search. Need this in Linux. (1 Reply)
Discussion started by: mohtashims
1 Replies

8. Shell Programming and Scripting

grep a string with include next 100 line

Hi, I have a log file which has number of lines from that i have to grep a string like this 03:22:19,287 while greping this string i have to grep next lines to the maximum of finding the word (MORE...) the stack is like this ************* 22/11/2011 03:22:19,287 232290646 ERROR... (2 Replies)
Discussion started by: thelakbe
2 Replies

9. UNIX for Advanced & Expert Users

grep source code and exclude comments

I often find myself grepping source code for a variable name and many times the name would be present in comment lines that I 'd prefer not to see. Do you guys know any tricks to filter out comments? Example: snippet of the source code /*** * type comment 1 ***/ void ... (7 Replies)
Discussion started by: migurus
7 Replies

10. UNIX for Advanced & Expert Users

how to exclude the GREP command from GREP

I am doing "ps -f" to see my process. but I get lines that one of it represents the ps command itself. I want to grep it out using -v flag, but than I get another process that belongs to the GREP itself : I would like to exclude # ps -f UID PID PPID C STIME TTY TIME CMD... (2 Replies)
Discussion started by: yamsin789
2 Replies
Login or Register to Ask a Question