0
votes
1answer
33 views

I have file called songs and i'm trying to find the longest and shortest song name using AWK

RANK NAME BAND YEAR GENERE DOMESTIC/INTERNATIONAL 206:Reach Out, I'll Be There:The Four Tops:1978:Pop:3/2 207:Bye Bye Love:The Everly Brothers:1950:Classic:3/2 ...
2
votes
0answers
28 views

find using regexp and echo matches

I have about 50 users in /home/ directory and I have cloned a git repository to everyone: Executed at /home/ as root user: find . -maxdepth 1 -type d ! -name . -prune -exec git clone ...
4
votes
3answers
76 views

Using Unix's find command to find directories matching name but not subdirectories with same name

Edited: I mistakenly misrepresented my problem. A more accurate example now appears below. I'd like to recursively walk all directories inside a target directory, and stop each recursive call after ...
0
votes
3answers
57 views

How to exec two commands in one find

I would like to find specific folders echo their name ls -l their contents My problem is that I don't know how to combine an echo {} and an ls -l {} in one find command. line for echo: sudo ...
2
votes
1answer
71 views

Simple find and copy script for linux [closed]

I'm quite a newbie to scripts in Linux. What im trying to get is a simple script that finds a file by its exact name, then copy that file to a different folder. So Essentially it should work like ...
1
vote
3answers
73 views

Unix delete with find: Delete all files that are listed in a file

In my root directory, I have a couple folders named something like AA, BB, CC etc., each containing files in the format AA1001.txt, BB1002.txt etc. In my root folder, I also have a file all_to_delete ...
1
vote
2answers
28 views

Excluding a file from UNIX “find” results based on existence of another file

I have a big bunch of directories, each with a series of .pdf files. Some of these files have successfully converted to .csv, some have not. An example directory listing using find ./: ...
2
votes
1answer
64 views

*nix find -type flag: can it accept multiple types?

I want to use find for getting all simlinks and regular files. I can use the -type for these individually, and I can use -o to string them together, but I apparently can't do -type fl. Is there a way ...
1
vote
2answers
71 views

How do I search for a string in a group of files when some of those files contain spaces?

I'm running Mac 10.7.5. In a terminal, I'll use this command for finding files with strings find src/main -name "*" | xargs grep -i 'mystring' However when the files contain spaces, I'll get ...
0
votes
2answers
632 views

using awk with find -exec

I have a directory structure with 14 directories containing a bunch of files containing data in a three-column format (separated with tabs). I intended to use find and awk to extract the second column ...
3
votes
1answer
337 views

How to find a file whose size is less than 10 MB?

I need to find a file in my current directory whose size should be less than or equal to 10 MB. ls -lh gives me the file size of each file but not sure how to find the files whose size are less than ...
0
votes
0answers
60 views

Find files based on content and sender, receiver and based on date range provided

I would like to find files based on content and sender, receiver based date range provided More details below: Find files between date range (where folder names are the dates in the format yyyyMMdd) ...
1
vote
1answer
59 views

How to only remove file extensions while keeping other parts as they are

I have quite a few files with different extensions sitting under sub folders like 'aaa' /f1/aaa/a.txt /f1/aaa/a.sql /f1/f2/aaa/b.txt /f1/f2/aaa/b.csv what I need is to extract all these files from ...
1
vote
1answer
53 views

What is the meaning of -perm -400 in find command?

I found in a text the command find / -name "foo" -perm -400. What does the -perm -400 indicate?
1
vote
2answers
977 views

find command: search for files owned by many users in one command

In Linux, is there a way to do a search for files owned by multiple users (or group(s) of users) with the "find" command? Something like this? find . -user john, akido
2
votes
2answers
177 views

Using find before wc eliminates total

I'm using find to search through all subdirectories and current directory to find all .py files, and then run wc -l to find number of lines. However, when I use find with wc, the Total field is left ...
0
votes
1answer
73 views

Find .gz file using original file

I would like to retrieve a .gz file from a directory based on original file name. Please let me know how to do this. In the below example, I know only original file name (02.txt), and I need to ...
0
votes
2answers
334 views

Unix command for finding and deleting folders with folder names in date format

I have folder names in the below date format 20130801 20130802 20130803 20130804 20130805 20130806 20130807 20130808 . . . 20130819 Similarly ,I have folders created from past two years for each ...
0
votes
1answer
46 views

SSH private Keys

I want to use a simple command to count the number of ssh keys in a users home folder, but would rather use the output from the /etc/passwd file as input. The find command is easy: find ...
1
vote
1answer
106 views

Linux command find -print. When to I need this option?

What is the difference between: find . -name "*.txt" and find . -name "*.txt" -print ? I mean what is the use of print in find. I see that it prints the results anyway so why is this option ...
-1
votes
2answers
46 views

Unix - Searching for every file with a certain string in it

I am searching for every file within a root directory and want to search every subdirectory as well. I have tried grep -r "message" * but I am not sure that this searches every subdirectory, any ...
3
votes
2answers
1k views

Efficient way to search string within file find and grep

I am searching all files containing a specific string on a filer (on an old HP-UX workstation). I do not know where the files are located in the file system (there are many directories, with hudge ...
2
votes
2answers
1k views

How can I make `find` find files in reverse chronological order?

I want to find files in subdirectories sorted by timestamp (of creation), with most recent first. I have looked at the man page but it seems to only seems to let you filter by timestamp rather than ...
3
votes
1answer
308 views

Delete old log files in AIX

I am trying write a script to delete old log files in \var\log\applog\nmon on my AIX system. We usually get alerts that the file system is almost full and at the moment delete old files by hand. So ...
0
votes
1answer
93 views

Listing unreadable group files in Unix

Is there a way I can list ordinary files that are unreadable by a group in Unix? What would be the necessary code for that? And can I do it without using the find command?
0
votes
1answer
17 views

Extracting output only from the current directory

How can I extract from the output of find . -name "*.c" -print only filenames in the current directory? Why does it always include the subdirectories? Need help with getting aorund that.
3
votes
2answers
256 views

linux: is tree -i -f -L $depth supposed to be faster than find -maxdepth $depth?

I am querying specific directories to see if I find files with a specific pattern in them and I have been trying it with two different commands: Standard find command: find -L $unix_dir\*/ -maxdepth ...
0
votes
1answer
1k views

Using find with -exec gzip and grep

I have a bunch of zipped up log files and I want to search them all for a string. I tried this but it's not working: find ./ -name "*.log.zip" -exec gzip -dc {} | grep ERROR \; It's giving me: ...
2
votes
1answer
70 views

Using inode number to locate hardlinks

How can I use the inode number to locate all hardlinks to the file "file.txt" in my home directory?
0
votes
1answer
89 views

Single “find” command with multiple arguments?

I need to devise a single find command that searches for: All C# or Java programs Located in the home directory of the current user Have at least one hard link Readable for everybody Have at least ...
-1
votes
2answers
51 views

How to search a tree folder

How can I do a search of all directories calles i18n under trees like src/main/resources using find or any other unix command. Everything I'm trying doesn't work I'm looking for something like: ...
0
votes
1answer
80 views

mv command - parametric source and target

I have folder "F A" containing some subfolders and files and another folder "F B" containing the same folder structure but no file: find . -type d . ./F A ./F A/SF A ./F A/SF B ./F A/SF C ./F B ./F ...
0
votes
1answer
273 views

Unix - Find files with the same name under a directory using ls

I want to list all suhosin.ini files under /etc/php5/ directory. The thing is that the 3 of them are one level deeper in the directory tree. I want to combine these two to one command # ls ...
1
vote
4answers
248 views

Does running the 'find' command fork a new process?

When I type find in unix a shell, is a new process created (to handle the find operation) or not? And why?
1
vote
1answer
47 views

How can I select files which meet a condition in a directory structure

In have a big directory tree in OSX (Mountain Lion), and I need to delete all the files below a certain threshold filesize. I could create a duplicate of the directory excluding the small files, or ...
1
vote
2answers
100 views

FIND operands and order of arguments

I have a find command that I am unsure if I am placing my arguments correctly. find / -xdev -size -size -262144000c -o -type d \( -name .snapshot -o -name man -o -name Man -o -fstype mvfs \) -prune ...
1
vote
1answer
3k views

Unix/Linux: recursively search for files containing a string [duplicate]

Possible Duplicate: How to Combine find and grep for a complex search? ( GNU/linux, find, grep ) I have a directory hierarchy of files (some of which are plaintext and others are binary). ...
0
votes
1answer
244 views

Exclude all hidden directories in UNIX find

I'm doing a word search using the following command: find . -exec grep -q [some_word] '{}' \; -print -o -name .svn -prune -o -name .ssh -prune -o -name .boneyard -o -name log -prune -prune -o -name ...
1
vote
6answers
1k views

UNIX “find” command, match literal “dot”

I need files ending with ".pdf" or ".png"; here's my attempt: find /Users/robottinosino/Desktop/_PublishMe_ -type f -regex '.*[pdf|png]' this incorrectly includes files ending with "Apdf", "Zpdf", ...
1
vote
2answers
110 views

How can I avoid descending certain directories with 'find'?

Currently I have this find command which avoids descending particular directories: find . \! \( -name ".hg" -prune \) \! \( -name "localhost" -prune \) \! \( -name "logs" -prune \) -type f The ...
8
votes
3answers
3k views

Using `find` for multiple file extensions

I am using the following command for counting the lines of text in JAVA files: find . -name '*.java' | xargs wc -l How can I modify the find command parameters to match more than one file ...
3
votes
1answer
1k views

Subshell arguments in -exec parameter for find(1)

Why doesn't find . -type f -exec echo $(file={}; echo ${file:0:5}) \; give the first five characters of the file, while this works: find . -type f -exec bash -c 'echo ${1:0:5}' funcname {} \; ...
0
votes
2answers
1k views

How can I use the find command to remove directories without eliminating certain subdirectories?

I am trying to modify the following command in a script that removes directories based on age. Example directories would be the following: /a/b/c/2011/11/11 /a/b/c/2011/11/11/12-ACD-1234 ...
4
votes
1answer
185 views

Why does $ find -delete not work sometimes?

I think what I'm talking about is this part of the manpage, which is just barely too indecipherable for me: -delete ... It will not attempt to delete a filename with a ``/'' character in its ...
0
votes
1answer
201 views

find command giving different outputs with/without -print

find src/ -name "*.cc" -o -name "*.cpp" -print find src/ -name "*.cc" -o -name "*.cpp" The intended behavior is to find all C++ files in a directory and all its subdirectories. As I understood it, ...
-2
votes
2answers
403 views

Shell script error using command find

My script is supposed to: recursively look for files and directories whose names contain given strings, using find, starting in the current directory. If no arguments are given the message Missing ...
0
votes
1answer
1k views

Unix pipe: find | ln -s

I'm trying to symlink some php files using the following command: find `pwd` -name "*.php" | ln -s * /home/frankv/www/bietroboter.de/symlinks However, all the symlinks are broken because the little ...
0
votes
3answers
294 views

Location of files on Unix whose file names and contents each match a regular expression

I want to search for file names with a regular expression, and grep it using regex. I tried this: find . -name co_on*eruo* | xargs grep '0LF2C Comdty(.*)20111022(.*)' But it doesn't work. What am ...
0
votes
1answer
230 views

Use “find” command to list files IN specified directory

I'm putting together a perl script, and I'm using the following command to list all files and directories under a specified directory `find $dir -print` This lists all files and directories UNDER ...
3
votes
2answers
225 views

How can I speed up a selective deep copy command in unix?

I am (ab?)using the unix 'find' command to recursively export files from a directory tree that is littered with .svn directories. This command takes a long time to run. Is there a faster way to ...