Well I thought firstly I would have a closer look at your "solution" and it seems it does not work for me at least not the output I would
have expected. Now correct me if I am wrong but from your snippet I have made the following assumptions:
1. Still using original example - /ftp/prod/SWC1407.DOC
2. You have an earlier piece of code stripping the file name from the path
With this in mind I ran the following:
Code:
FILE_NAME=SWC1407.DOC
echo $FILE_NAME|cut -c7-10
The output of this for me is:
Which doesn't really look right to me
But in answer to your question:
[quote]could you tell me how to deal in those cases so that i could learn something[/code]
Here is one possible way:
Code:
var=/ftp/prod/SWC1407.DOC
file_name=$(basename $var)
echo ${file_name//[^0-9]/}
Output for this is: