473,320 Members | 1,857 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Find files in Linux

I m kind of stuck ...i need to find files with a specific criteria but i can not make it work ....

These are the ones :

1.How do you Find files under /root that contain the whole words (i.e., not part of another word) 'foo', 'bar', 'baz', 'cat', 'cut', 'cot.' using a single command ?

I tried :find /root -name 'foo.*' -name 'baz.*'-name 'cat.*'-name 'cut.*'-name 'cot.*'
but seems that is not right

2.Find files under /var that contain the character list 'xxx' or 'xxxx' or 'xxxxx'. Using \{\} and adding two lines of context before AND after each keyword found. ..

my answer: find /var -name 'xxx' ,'xxxx, 'xxxxx'

At this point i am lost ....

Any help will be very much appreciated
Feb 1 '07 #1
4 3161
Motoma
3,237 Expert 2GB
I m kind of stuck ...i need to find files with a specific criteria but i can not make it work ....

These are the ones :

1.How do you Find files under /root that contain the whole words (i.e., not part of another word) 'foo', 'bar', 'baz', 'cat', 'cut', 'cot.' using a single command ?

I tried :find /root -name 'foo.*' -name 'baz.*'-name 'cat.*'-name 'cut.*'-name 'cot.*'
but seems that is not right

2.Find files under /var that contain the character list 'xxx' or 'xxxx' or 'xxxxx'. Using \{\} and adding two lines of context before AND after each keyword found. ..

my answer: find /var -name 'xxx' ,'xxxx, 'xxxxx'

At this point i am lost ....

Any help will be very much appreciated
For number 1, do you mean that have filenames containing those words, or the files themselves containing those words?
The tools you want in the latter case are grep and sed, not find.
Actually, I think both questions are looking for answers involving sed.

A little more on sed.
Required reading for sed (i.e. Regular Expressions).
Feb 2 '07 #2
No , i s not grep because we are looking for file names no strings within a file .
I know FIND must be used but i dont remember the correct parameters ..
Feb 2 '07 #3
Motoma
3,237 Expert 2GB
No , i s not grep because we are looking for file names no strings within a file .
I know FIND must be used but i dont remember the correct parameters ..
In the future, you can use the command line utility man to find syntax for linux commands:

Expand|Select|Wrap|Line Numbers
  1. % man find
  2.  
Here is a web version of the man page.
Feb 2 '07 #4
find /root -name 'foo' -print is the command to find files
Feb 11 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

12
by: hokiegal99 | last post by:
The below code does what I need it to do, but I thought that using something like ext = os.path.splitext(fname) and then searching ext for '.mp3' would be a much more accurate approach to solving...
1
by: Thieum22 | last post by:
Hi, I try to go through a directory and it's subdirectories to reah the properties of each files. But I have a problem to set active the directory where the files are, in order to display their...
3
by: Dean Arpajian | last post by:
Looking to find info/ libs on creating (small) video files. Basically what I'm looking for is a tutorial for constructing a short video... (nothing nasty: output from a transmission line...
15
by: David T. Ashley | last post by:
I'll be using gcc under Red Hat Enterprise Linux. Where do I find information about the low-level calls to the operating system from compiled 'C'? For example, if I want to cause a process to...
17
by: krishnakant Mane | last post by:
hello all, I am stuck with a strange requirement. I need a library that can help me display a pdf file as a report and also want a way to print the same pdf file in a platform independent way....
2
by: enquiring mind | last post by:
-learning python with limited knowledge of linux. -get error msg 21 "file or directory does not exist" -running Suse linux 10. -haven't had a problem before - rebooted several times. -python...
1
by: Kesavan | last post by:
I install apache2 in /usr/local/apache2 and install php5 by ./configure --with-apxs2=/usr/local/apache2/bin/ apxs PHP is successfully installed in my system. But now my .php files inside...
7
by: Patricia Mindanao | last post by:
I have a directory tree on my hard disc which represents all the web pages and linked stuff on my mirrored web hoster server. All web pages and files are statically linked. So dynamically...
3
by: michalkuls | last post by:
Hi, I have a problem with my linux apache+php installation. I don't know much about linux and it appears a real nightmare for me every time I need to change anything. When I look at the file...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.