Operating System - HP-UX
1753440 Members
4799 Online
108794 Solutions
New Discussion

Perl/or script command to grab from 3 char of filename to the end of filename ?

 
Sammy_2
Super Advisor

Perl/or script command to grab from 3 char of filename to the end of filename ?

got a list of filenames below

 

#ls

testing

trying

wonder

caprel

 

 cp the file above with new names as following (grab 3 character to the end of file) with the new filename  below after executing the command

 

sting

ying

nder

prel

 

good judgement comes from experience and experience comes from bad judgement.
2 REPLIES 2
Steven Schweda
Honored Contributor

Re: Perl/or script command to grab from 3 char of filename to the end of filename ?

 
Dennis Handly
Acclaimed Contributor

Re: Perl/or script command to grab from 3 char of filename to the end of filename?

Besides sed, you can also use shell parameter substitution:

fname=testing

echo ${fname#??}