Sponsored Content
Top Forums Shell Programming and Scripting Need help in writing script for finding files in the unix machine? Post 302242995 by joeyg on Friday 3rd of October 2008 10:49:10 AM
Old 10-03-2008
Hammer & Screwdriver Is this what you are looking for?

I often use a filename called file1 when testing things. So, it ends up in many of my subdirectories.

Code:
[ ~/tmp ] > find . -name file1
./file_lookup/file1
./sort_stuff/file1
./sort_stuff/moved/file1
./verify_format/file1
./edit_text/file1
./text_manip/file1
./sep2files/file1
./unique/file1
./repl_list/file1
./header_ins/file1
./fixed_data/file1
./join_lines/file1
./add_files/file1
./math/file1
./3rec_types/file1
./copy_archive/file1
./concat_files/file1
./extract_data/file1
./remove_lines/file1
./co_loop/file1
./complex_select/file1
./combine_common/file1
./awk_do_something_next/file1

If you want to search your entire system, try the following:
Code:
> find / -name file1 2>/dev/null

The 2>/dev/null is to redirect all the possible errors from the system telling you that you do not have rights to read certain directories. This just makes the output 'cleaner' to read. And, go grab a cup of coffee as this search may take a few minutes, or more.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Unix shell script for finding top ten files of maximum size

I need to write a Unix shell script which will list top 10 files in a directory tree on basis of size. i.e. first file should be the biggest in the whole directory and all its sub directories. Please suggest any ideas (10 Replies)
Discussion started by: abhilashnair
10 Replies

2. Filesystems, Disks and Memory

Writing files from Unix to 3480 Tape

I am trying to learn what command I would need to enter to tell my very old tape writer to write a large > 210 MB file from a UNIX box to 3480 tapes. I can get a single tape to write < 210 MB but if the file is large I am not aware of what command to enter to tell it to split the input file across... (0 Replies)
Discussion started by: james.hodge@eds
0 Replies

3. Shell Programming and Scripting

Writing script for finding a string and replacing

Hi all i need some help in writing a small script that searches a string and then replaces it by a new string for searching the best result i get is from find comand combined with xargs e.g. find . -name "*.*" |xargs grep -l "search string" this command I use in root directory and this... (4 Replies)
Discussion started by: Aditya_IT
4 Replies

4. Shell Programming and Scripting

writing script in UNIX for copying files in two server

can anyone help me in writing script in UNIX for copying files in two server from the third server after checking the files in the third server and if there is anything new in the third server automatically it should be added to the rest of the two servers and if same file is existing in the two... (4 Replies)
Discussion started by: REKHA09
4 Replies

5. Shell Programming and Scripting

help writing this unix script

I am working on writing scripts. Here is a script I need help with. I have also wrote what I think it is. I would really appreciate any help that I can get. Create an executable script file called "newname" that will perform the followings: 1. Rename a file upon the user's request. If the... (2 Replies)
Discussion started by: wiggles
2 Replies

6. Shell Programming and Scripting

need help writing this unix script

Create an executable script file called "newname" that will perform the followings: 1. Rename a file upon the user's request. If the file exists, prompt the user for confirmation before renaming the file. The screen should prompt the user for a. "Name of file you want to rename." Use the "\c"... (7 Replies)
Discussion started by: wiggles
7 Replies

7. Shell Programming and Scripting

ftp from windows to unix using a perl script on unix machine

i need to ftp a file from windows to a unix machine by executing a sript(perl/shell/php) from that unix machine.i can also use HTML and javascript to build forms. (3 Replies)
Discussion started by: raksha.s
3 Replies

8. Shell Programming and Scripting

shell script to copy files frm a linux machine to a windows machine using SCP

I need a shell script to copy files frm a linux machine to a windows machine using SCP. The files keeps changing day-to-day. I have to copy the latest file to the windows machine frm the linux machine. for example :In Linux, On July 20, the file name will be 20.txt and it should be copied to... (3 Replies)
Discussion started by: nithin6034
3 Replies

9. Shell Programming and Scripting

How to transfer files from unix machine to local machine using shell script?

Hi All.. Am new to Unix!! Am creating a shell script in which a scenario is like i have transfer the output file from unix machine (Server) to local directory (Windows xp). And also i have to transfer the input file from the local directory to Unix machine (Server) Any help from you... (1 Reply)
Discussion started by: vidhyaS
1 Replies

10. Shell Programming and Scripting

Finding total distinct count from multiple csv files through UNIX script

Hi All , I have multiple pipe delimited csv files are present in a directory.I need to find out distinct count on a column on those files and need the total distinct count on all files. We can't merge all the files here as file size are huge in millions.I have tried in below way for each... (9 Replies)
Discussion started by: STCET22
9 Replies
DIFF(1) 						      General Commands Manual							   DIFF(1)

NAME
diff - print differences between two files SYNOPSIS
diff [-c | -e | -C n] [-br]file1 file2 OPTIONS
-C n Produce output that contains n lines of context -b Ignore white space when comparing -c Produce output that contains three lines of context -e Produce an ed-script to convert file1 into file2 -r Apply diff recursively to files and directories of EXAMPLES
diff file1 file2 # Print differences between 2 files diff -C 0 file1 file2 # Same as above diff -C 3 file1 file2 # Output three lines of context with every diff -c file1 file2 # Same diff /etc /dev # Compares recursively the directories /etc and /dev diff passwd /etc # Compares ./passwd to /etc/passwd DESCRIPTION
the same name, when file1 and file2 are both directories" difference encountered" Diff compares two files and generates a list of lines telling how the two files differ. Lines may not be longer than 128 characters. If the two arguments on the command line are both directories, diff recursively steps through all subdirectories comparing files of the same name. If a file name is found only in one directory, a diagnostic message is written to stdout. A file that is of either block special, character special or FIFO special type, cannot be compared to any other file. On the other hand, if there is one directory and one file given on the command line, diff tries to compare the file with the same name as file in the directory directory. SEE ALSO
cdiff(1), cmp(1), comm(1), patch(1). DIFF(1)
All times are GMT -4. The time now is 09:43 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy