How can I use the find command to list only first file that matches the name
for example
dir/dir1/file1
dir/dir2/file1
dir/dir3/dir4/file1
find dir -name file1
I just want to print
dir/dir1/file1
Thanks
How can I use the find command to list only first file that matches the name
for example
dir/dir1/file1
dir/dir2/file1
dir/dir3/dir4/file1
find dir -name file1
I just want to print
dir/dir1/file1
Thanks
Try find dir -name file1 | head -1
In unix ,
$ls filename_*.txt | head -1
find / -name name*.txt | head -1
i hope this will give you the proper output.