Sponsored Content
Top Forums UNIX for Dummies Questions & Answers find . -name "*.*" | xargs grep "help" Post 302529427 by neil.k on Thursday 9th of June 2011 10:03:42 AM
Old 06-09-2011
find . -name "*.*" | xargs grep "help"

Hi all,

I am a unix noob. Need some basic help. I have tried using google, but not able to figure this out.

Here are the scenarios:

1. How do I find a directory with a particular name, say "Merlin" in the entire file system? I tried :
Code:
find / -type d -name "dir_name"

The problem is I'm getting thousands of lines, most of them with "blah blah blah...Permission denied".

How can I have only the relevant information, the directory that I am looking for with its path.

2. How do I find a file with name "unicorn", where I do not know it's directory location?
Code:
find . -name "unicorn" -print

.

Same problem, lots of hits with "permission denied".

3. How do I find a file, where I do not know it's location which has a particular pattern inside the file.

This was a bummer. Couldn't find anything. Please help.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

grep and xargs

guys... I wanna use xargs in such a way that i can use it in grepping the fileds.. something like this: grep -p <xargs values> * lemme know how to do this.. (5 Replies)
Discussion started by: freakygs
5 Replies

2. UNIX for Dummies Questions & Answers

problem with grep in combination with xargs

Dear all, I have tried the following 2 lines xargs -t -i -exec grep -i -w {} file_1 >>test < file_2 cat -s file_2| xargs -t -i -exec grep -i -w {} file_1 >> test They were meant to search for the contents of file_2 in file_1 and write the respective lines of file_1 into file "test" .... (15 Replies)
Discussion started by: Bruno
15 Replies

3. UNIX for Dummies Questions & Answers

XARGS and FIND together

I am trying to delete files older than 60 days from a folder: find /myfolder/*.dat -mtime +60 -exec rm {} \; ERROR - argument list too long: find I can't just give the folder name, as there are some files that I don't want to delete. So i need to give with the pattern (*.dat). I can... (3 Replies)
Discussion started by: risshanth
3 Replies

4. Shell Programming and Scripting

find and xargs

hi, i've been trying to figure this weird error but I cannot seem to know why. I am using below find command: find . \( ! -name . -prune \) -type f -mtime +365 -print The above code returns no file because no files are really more then 365 days old. However, when I use xargs, its... (9 Replies)
Discussion started by: The One
9 Replies

5. Shell Programming and Scripting

File find | xargs grep for pattern file

Folks I've been struggling this with for far too liong now and need your help! I've been happily using grep for a search of a directory, to list the files which contain a string: find . -type f -mtime -5 -print | xargs grep -l 'invoiceID=\"12345\"' Now the list of 'invoiceID' I am... (4 Replies)
Discussion started by: daveaasmith
4 Replies

6. Shell Programming and Scripting

Xargs + Find Help

Guys i want to run a command to list all directories that havn't been modified in over 548 days ( 1.5 yrs ). Id like to run a script to first print what the command finds ( so i get a list of the files pre move ... i have a script set for this : find /Path/Of\ Target/Directory/ -type d -mtime... (4 Replies)
Discussion started by: modulartention
4 Replies

7. Shell Programming and Scripting

Find common terms in two text file, xargs, grep

Hello, I'm interested in finding all occurrences of the terms in file1 in file2, which are both csv files. I can do this with a loop but I'm interested in knowing if I can also do it with the help of xargs and grep. What I have tried: cat file1 | xargs grep file2 The problem is that... (15 Replies)
Discussion started by: eon
15 Replies

8. UNIX for Dummies Questions & Answers

find/xargs/*grep: find multi-line empty "try-catch" blocks - eg, missing ; not in a commented block

How can I recursively find all files in a directory and print out the file and first line number of any text blocks that match the below cases? This would seem to involve find, xargs, *grep, regex, etc. In summary, I want to find so-called empty "try-catch blocks" that do not contain code... (0 Replies)
Discussion started by: lifechamp
0 Replies

9. Shell Programming and Scripting

Help with find, xargs and awk

Hi, I want to find some files and then search for some lines in it with a particular pattern and then write those lines into a file. To do this I am using something like this from command prompt directly. cd /mdat/BVG find -name "stmt.*cl" -newer temp.txt | xargs -i awk '/BVG-/{print}' {} >... (7 Replies)
Discussion started by: Sandhya Harsh
7 Replies

10. Shell Programming and Scripting

Looping grep and xargs

In a directory I have two lists, all files which could contain certain fields (they all share copied code) and a list of fields. My two scripts are <appl.list xargs grep $1 where appl.list contains files (source programs) with the fields. This script is named YY <fields.list xargs YY ... (4 Replies)
Discussion started by: wbport
4 Replies
MKDIR(2)						      BSD System Calls Manual							  MKDIR(2)

NAME
mkdir -- make a directory file SYNOPSIS
#include <sys/stat.h> int mkdir(const char *path, mode_t mode); DESCRIPTION
The directory path is created with the access permissions specified by mode and restricted by the umask(2) of the calling process. See chmod(2) for the possible permission bit masks for mode. The directory's owner ID is set to the process's effective user ID. The directory's group ID is set to that of the parent directory in which it is created. Note: the behavior of mkdir() is undefined when mode bits other than the low 9 bits are used. Use chmod(2) after mkdir() to explicitly set the other bits (See example below). RETURN VALUES
A 0 return value indicates success. A -1 return value indicates an error, and an error code is stored in errno. ERRORS
Mkdir() will fail and no directory will be created if: [EACCES] Search permission is denied for a component of the path prefix. [EACCES] Write permission is denied for the parent directory. [EDQUOT] The new directory cannot be created because the user's quota of disk blocks on the file system that will contain the directory has been exhausted. [EDQUOT] The user's quota of inodes on the file system on which the directory is being created has been exhausted. [EEXIST] The named file exists. [EFAULT] Path points outside the process's allocated address space. [EIO] An I/O error occurred while making the directory entry or allocating the inode. [EIO] An I/O error occurred while reading from or writing to the file system. [ELOOP] Too many symbolic links were encountered in translating the pathname. This is taken to be indicative of a looping sym- bolic link. [EMLINK] The parent directory already has {LINK_MAX} links. [ENAMETOOLONG] A component of a pathname exceeded {NAME_MAX} characters, or an entire path name exceeded {PATH_MAX} characters. [ENOENT] A component of the path prefix does not exist or path is an empty string. [ENOSPC] The new directory cannot be created because there is no space left on the file system that would contain it. [ENOSPC] There are no free inodes on the file system on which the directory is being created. [ENOTDIR] A component of the path prefix is not a directory. [EROFS] The parent directory resides on a read-only file system. EXAMPLE
int main (int argc, const char * argv[]) { /* The behavior of mkdir is undefined for anything other than the "permission" bits */ if (mkdir("/tmp/blah", 0777)) perror("/tmp/blah"); /* So we need to set the sticky/executable bits explicitly with chmod after calling mkdir */ if (chmod("/tmp/blah", 07777)) perror("/tmp/blah"); } LEGACY SYNOPSIS
#include <sys/types.h> #include <sys/stat.h> The include file <sys/types.h> is necessary. SEE ALSO
chmod(2), stat(2), umask(2), compat(5) STANDARDS
The mkdir() function conforms to IEEE Std 1003.1-1988 (``POSIX.1''). 4.2 Berkeley Distribution December 11, 1993 4.2 Berkeley Distribution
All times are GMT -4. The time now is 10:47 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy