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 :
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?
.
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.
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)
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)
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)
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)
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)
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)
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)
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)
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)
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
LEARN ABOUT OSX
mkdir
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