Languages and Scripting
cancel
Showing results for 
Search instead for 
Did you mean: 

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
Steven Schweda
Honored Contributor

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

 
Highlighted
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#??}