04-03-2011
how to get only filename in a recursively find command
Hi i would like to ask on how to accomplish the FF:
I want to execute a find command recursively and only get the filename something like i want only the last field set if is used ever the fieldvset as an redirection from the output of the find command
For example:
dir1/dir2/filename1
dir1/filename2
dir1/dir2/dir3/filename3
and so on
...
....
Output
filename1
filename2
filename3
filename...
....
....
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I am using command substitution into a find command in a script where I have built a menu to do a bunch of tasks within my unix account. When I choose the options for to find a file/files that have the same inode of the entered filename, ie hardlinks, nothing shows up. When I choose the appropiate... (2 Replies)
Discussion started by: hunternjb
2 Replies
2. Shell Programming and Scripting
hi:
i have several thousand files from users and of course they use all kind of characters on filenames. I have things like:
My special report (1999 ) Lisa & Jack's work.doc
crazy.
How do I remove all this characters in the current dir and subdirs too?
Thanks. (3 Replies)
Discussion started by: jason7
3 Replies
3. Shell Programming and Scripting
Hi every body!
I would like to get only filename in the result of find command in Linux but I don't know howto. Tks so much for your helps. (5 Replies)
Discussion started by: nguyendu0102
5 Replies
4. Shell Programming and Scripting
Hi All
When we use find command command in Unix we get the result as
/home/user/folder/filename1
/home/user/folder/filename2
/home/user/folder/filename3
Is it possible that i only get the file name
The expected output when using find command is
filename1
filename2
filename3
I am... (13 Replies)
Discussion started by: parthmittal2007
13 Replies
5. Shell Programming and Scripting
I want to recursively cat the content of files in a directory e.g.
find /etc -type f -exec cat {} \;
But I want it to print the file name first and then the content. For example let's say /etc/statetab and /etc/colord.conf will be printed first then I want the output to look something like;
... (6 Replies)
Discussion started by: lewk
6 Replies
6. UNIX for Dummies Questions & Answers
I'm searching for particular scripts that contain pattern "BASIS" so I used the following command:
find . -type f -print | xargs grep "BASIS"
or
find . -type f -exec grep "BASIS" {} \;
However, I found out that the find command in the UNIX box that I'm working on doesn't find files... (6 Replies)
Discussion started by: The Gamemaster
6 Replies
7. Shell Programming and Scripting
Hi,
I am working in solaris.I am using below script to copy the files from /usr/tmp to /usr/gm
But while running this it is not considering the files list after the filename having space in them.
Example:-
compile_custom_pll.sh
conv_data_sqlload.sh
conv_sqlload.sh
Copy of... (5 Replies)
Discussion started by: millan
5 Replies
8. Shell Programming and Scripting
Running below command , but unable to print the filename , is there way to print filename/dirname using -print option
find . -type f -exec aclput -i fileacl.template {} \; (5 Replies)
Discussion started by: lalitpct
5 Replies
9. Shell Programming and Scripting
Hi,
How can I use find command to search string/pattern in a file recursively?
What I tried:
find . -type f -exec cat {} | grep "make" \;
Output:
grep: find: ;: No such file or directory
missing argument to `-exec'
And this:
find . -type f -exec cat {} \; -exec grep "make" {} \;... (12 Replies)
Discussion started by: cola
12 Replies
10. UNIX for Beginners Questions & Answers
Hi,
Below is list of files in my directory.
-rw-rw-r--. 1 Roots Roots 0 Dec 26 06:58 12345_kms_report.csv
-rw-rw-r--. 1 Roots Roots 0 Dec 26 06:59 12346_kms_report.csv
-rw-rw-r--. 1 Roots Roots 0 Dec 26 06:59 12347_kms_report.csv
-rw-rw-r--. 1 Roots Roots 0 Dec 26 06:59... (2 Replies)
Discussion started by: Balraj
2 Replies
LEARN ABOUT OPENSOLARIS
diff3
diff3(1) User Commands diff3(1)
NAME
diff3 - 3-way differential file comparison
SYNOPSIS
diff3 [-exEX3] filename1 filename2 filename3
DESCRIPTION
diff3 compares three versions of a file. It publishes disagreeing ranges of text flagged with the following codes:
==== all three files differ
====1 filename1is different
====2 filename2is different
====3 filename3is different
The type of change suffered in converting a given range of a given file to some other is indicated in one of the following ways:
f : n1 a Text is to be appended after line number n1 in file f, where f = 1, 2, or 3.
f : n1 , n2 c Text is to be changed in the range line n1 to line n2. If n1 = n2, the range can be abbreviated to n1.
The original contents of the range follows immediately after a c indication. When the contents of two files are identical, the contents of
the lower-numbered file is suppressed.
The following command applies the resulting script to filename1.
(cat script; echo a'1,$pa') | ed - filename1
OPTIONS
The following options are supported:
-e Produce a script for the ed(1) editor that incorporates into filename1 all changes between filename2 and filename3 (that is, the
changes that normally would be flagged ==== and ====3).
Text lines that consist of a single dot (. defeat the -e option.
-E Produce a script that incorporates all changes between filename2 and filename3, but treat overlapping changes (that is, changes that
would be flagged with ==== in the normal listing) differently. The overlapping lines from both files are inserted by the edit
script, bracketed by <<<<<< and >>>>>> lines.
-x Produce a script to incorporate only changes flagged ====.
-X Produce a script that incorporates only changes flagged ====, but treat these changes in the manner of the -E option.
-3 Produce a script to incorporate only changes flagged ====3.
USAGE
See largefile(5) for the description of the behavior of diff3 when encountering files greater than or equal to 2 Gbyte ( 2^31 bytes).
FILES
/tmp/d3*
/usr/lib/diff3prog
EXIT STATUS
The following exit values are returned:
0 Successful completion.
1 An error occurred. A difference was found or there was a fatal error.
>1 A fatal error occurred.
Return values do not work the same as diff(1) or other vendor's versions of diff3.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWesc |
+-----------------------------+-----------------------------+
|CSI |Enabled |
+-----------------------------+-----------------------------+
SEE ALSO
diff(1), attributes(5), largefile(5)
NOTES
Files longer than 64 Kbytes do not work.
SunOS 5.11 7 Nov 2005 diff3(1)