In case you are looking files using ls or find command and only want to get the first file found, the command would be like.
ls -l /any/path/filename*|sed -e 's/\//,/g'|awk -F "," '{print $NF}'|head -1
Of course, you can also use it in find command.
find /any/path/ -name "filename*" -type f|sed -e 's/\//,/g'|awk -F "," '{print $NF}'|head -1
[Read more...]
Incoming search terms:
- unix find first file
Recent Comments