There are a lot of directories named like
web001
web002
...
web123
...
I want to extract a max-number from this set...
Something like num="´find -name /dirname sort ... | tail´"
with extracting. I have no ideas...
Thank you
There are a lot of directories named like
web001
web002
...
web123
...
I want to extract a max-number from this set...
Something like num="´find -name /dirname sort ... | tail´"
with extracting. I have no ideas...
Thank you
ls | sort | tail -n 1
Will tell you what the last folder sorted alphabetically is
You can use tr -dc [0-9]
to get rid of all non-numbers. Note that this also gets rid of the newline but if you extract just a single line with tail
, that does not matter.
If you want just the number:
find -type d -name web\* | sort | tail -n 1 | cut -d'b' -f2