stripping server name from path
can anyone help me with stripping an absolute filepath? I did a search on this topic but didnt find anything but maybe I didn't look hard. Anyway, would really appreciate it if anyone could help me. I am a new unix user so this might be a simple issue but I am stuck, don't really understand the use of 'grep'
here is the path that I have (dvrg12 is the server name) and this script is on the same server too
//dvrg12/usr/users/user_name/folder1/folder2/file_name
ideally I want to return only "/user_name/folder1/folder2/filename" and I obviously know the user_name.
thought of using a regular expression to search for the pattern of the server name since its always going to be the same. the format of the server name will be as follows (could be wrong):
[a-z]\{4\}[0-9]\{2\} == dvrg12 ?? if I could find the match and return everything after it then it would be ok from there but thats where I am stuck.
thanks in advance...could this be as simple as using the cut command? although that would only work if the path I was given always started with 2 forward slashes but what if it starts with only 1 forward slash or starts with no foraward slash?
D.
|