Languages and Scripting
Showing results for 
Search instead for 
Do you mean 

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

Highlighted
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
Honored Contributor [Founder]

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

 
Acclaimed Contributor [Founder]

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