Custom output on FIND

 
Thread Tools Search this Thread
Operating Systems Linux Red Hat Custom output on FIND
# 1  
Old 12-01-2009
Custom output on FIND

I have a file, ENV.doc somewhere in my home directory. I want to know where the file is located in my sub directories using FIND. But, I want to display only the relative path along with the file name.


Thanks,
# 2  
Old 12-01-2009
If you use find with a relative path (i.e. . (a dot) or directory name) then it will only display the relative path of the file.

Code:
$ find tmp -name file_1
tmp/file_1

# 3  
Old 12-02-2009
Thank You. It's working!

---------- Post updated at 02:13 PM ---------- Previous update was at 01:48 PM ----------

When I try the command
$find /home/Ashok -name ENV.doc
I am able to get the straight forward result. But, when I tried the same, finding the file starting from the root directory as
find / -name ENV.doc
I am getting several messages like
Code:
...........
...........
find: /home/portal: Permission denied
find: /home/itmuser: Permission denied
/home/Ashok/All About Linux and Unix/ENV.doc
find: /home/mou: Permission denied
find: /home/netcool: Permission denied
...........
...........

I know I am getting this becase I am a non root user. But I want to supress all those Permission Denied messages and want to get the straight forward message as above listed.


Thank you,

Last edited by pludi; 12-02-2009 at 04:45 AM.. Reason: code tags, please...
# 4  
Old 12-02-2009
Redirect the error messages away:
Code:
find / -name ENV.doc 2>/dev/null

# 5  
Old 12-02-2009
Here are we overwriting the contents of /dev/null by the error reports?
# 6  
Old 12-02-2009
Quote:
Originally Posted by ashok.g
Here are we overwriting the contents of /dev/null by the error reports?
Maybe you can read this:

/dev/null - Wikipedia, the free encyclopedia
# 7  
Old 12-02-2009
I am getting what I want now. Thanks for all your replies.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

LS -T Output in find

I have prepared a script with ls -t to fetch latest file and compare with duplicates i use below ls -t *xml |awk 'BEGIN{FS="_"}{if (++dup >= 2) print}' However for large size folder ls command not working. so i tried with find ./ -type f \( -iname "*.xml" \) | sort |awk 'BEGIN{FS="_"}{if... (2 Replies)
Discussion started by: gold2k8
2 Replies

2. Shell Programming and Scripting

Awking custom output

i have data that can look like this: echo "Master_Item_Service_is_down=0_njava_lang_NoClassDefFoundError=0_njava_lang_OutOfMemoryError=1_nemxCommonAppInitialization__Error_while_initializing=0_nINFO__Stopping_Coyote_HTTP_1_1_on_http_8080=7_nThe_file_or_directory_is_corrupted_and_unreadable=0_n" ... (7 Replies)
Discussion started by: SkySmart
7 Replies

3. Shell Programming and Scripting

Custom wget output

The below hides the messy commands of wget #!/bin/bash cd 'C:\Users\cmccabe\Desktop\wget' wget -O getCSV.txt http://172.24.188.113/data/getCSV.csv progressfilt () { local flag=false c count cr=$'\r' nl=$'\n' while IFS='' read -d '' -rn 1 c do if $flag ... (5 Replies)
Discussion started by: cmccabe
5 Replies

4. Shell Programming and Scripting

Output find to array

Hi I'm trying to write a shell script which finds all the .zip files in a given directory then lists them on the screen and prompts the user to select one by entering a number e.g. The available files are: 1. HaveANiceDay.zip 2. LinuxHelp.zip 3. Arrays.zip Please enter the... (4 Replies)
Discussion started by: zX TheRipper Xz
4 Replies

5. Shell Programming and Scripting

Script to output custom characters in different order

Need a script to print a set of characters in different combination. What's the key to accomplish this. e.g charset: "Abcdefghij1" without quotes. block 1: "Abcd" block 2: "efg" block 3: "hij1" I need this script to change the order of the characters and print it to stdout e.g print out... (3 Replies)
Discussion started by: zaonline
3 Replies

6. HP-UX

Output of Custom package scripts to terminal

Hi, I am doing some testing with creation of depots on HP-UX systems (11.11). Want to display some echo statements based on the processing during checkinstall, pre & postinstall scripts on the terminal. The echo statements are getting directed to /var/adm/sw/swagent.log I want to display... (7 Replies)
Discussion started by: vibhor_agarwali
7 Replies

7. Shell Programming and Scripting

Find Format Output

Hi, I wanna format the output in find to be like this : NUM SIZE TYPE NAME 1 942080 DIR ./a/b/CaChE.xyz 2 888832 FIC ./a/b/core.1234 3 389120 FIC ./a/b/core.12 4 229376 FIC ./xxx/xyz.bak.cache I don't know if its possible. For... (1 Reply)
Discussion started by: naminator
1 Replies

8. UNIX for Dummies Questions & Answers

Redirecting 'find' output...

Hi all, why does one version of this command work but not the other? - This file already exists with 644 mod permissions - I am logged in as d269836, no su rights. - Box is 'SunOS' running bash I think; but runs ksh scripts OK. This one works: find /users/d269836 -type f -name "*.txt"... (6 Replies)
Discussion started by: dan-e
6 Replies

9. UNIX for Dummies Questions & Answers

output of find command

Hi, I am confused about the output of find command. Please see the two find commands below. When i put "*.c" i get lots of files. But when i put *c only i get only one file. Any answer?? $ find . -name "*c" ./clarify/cheval/hp_server/rulemanager/rulemansvc... (3 Replies)
Discussion started by: shriashishpatil
3 Replies

10. UNIX for Dummies Questions & Answers

Output of find

I have a find command that finds all files in a folder older than 6 days i.e find . -name "hourly.*" -mtime + 6 This gives me an output /oralogs/.snapshot/hourly.0 /oralogs/.snapshot/hourly.1 /oralogs/.snapshot/hourly.2 I would like the output to be hourly.0 hourly.1... (5 Replies)
Discussion started by: NeerajSingh
5 Replies
Login or Register to Ask a Question