* expansion
Hello
i have two text files in the current directory: lserror.txt lsouput1.txt while executing the below command to find files without double quotes as "*.txt" it is throwing error find . -type f -name *.txt But the below command without double quotes as "*.txt" is giving correct result ls *.txt pls explain |
You have to pass a literal asterisk to the find command, otherwise the shell expansion brings to a wrong command line. Since the .txt files are in the current working directory, the shell substitutes their name in the command line, givin'
Code:
find . -type f -name lserror.txt lsouput1.txt Code:
ls lserror.txt lsouput1.txt Code:
find . -type f -name \*.txt |
@colucix..thnks for the stuff..
But it seems all the below commands are going to recursion giving text files within sub directories as well... f u can help Quote:
|
find is recursive by its nature, but you can limit the level of recursion (that is how much it descends into subdirectories) using -maxdepth (and eventually the related -mindepth) expression. In order to limit the search to the current working directory, you can try:
Code:
find . -maxdepth 1 -name \*.txt Code:
ls *.txt |
Thanks a lot....this was really helpful.
Quote:
|
All times are GMT -5. The time now is 02:02 PM. |