Operating System - HP-UX
1834784 Members
2455 Online
110070 Solutions
New Discussion

Directory naming convention

 
SOLVED
Go to solution
Danny Crisp
Frequent Advisor

Directory naming convention

i have several directories that have the following naming convention: -

dir1234
dir5678

How would I display just the numbers for dir1234 for example and exclude dir?
3 REPLIES 3
Peter Godron
Honored Contributor
Solution

Re: Directory naming convention

Danny,

a="dir1234"
echo $a | cut -c4-
James R. Ferguson
Acclaimed Contributor

Re: Directory naming convention

Hi:

There are several ways. One is to use the shell's built-in parameter substitution.

# X=dir123; echo ${X##dir}

See the manpages for 'sh-posix(1)' for details.

Regards!

...JRF...
Danny Crisp
Frequent Advisor

Re: Directory naming convention

Thanks gents.