Skip to main content
added 99 characters in body
Source Link
Jetchisel
  • 1.6k
  • 9
  • 12

Here is one using bash specific P.E.P.E. parameter expansion.

file=35554842200284685106000166550020003504201637715423.xml 

Only mv for external tools

mv -v "$file" "${file:6}" 

Output

renamed '35554842200284685106000166550020003504201637715423.xml' -> '42200284685106000166550020003504201637715423.xml' 

Keeping the last 48 chars would be.

mv -v "$file" "${file:(-48)}" 

Here is one using bash specific P.E. parameter expansion.

file=35554842200284685106000166550020003504201637715423.xml 

Only mv for external tools

mv -v "$file" "${file:6}" 

Output

renamed '35554842200284685106000166550020003504201637715423.xml' -> '42200284685106000166550020003504201637715423.xml' 

Keeping the last 48 chars would be.

mv -v "$file" "${file:(-48)}" 

Here is one using bash specific P.E. parameter expansion.

file=35554842200284685106000166550020003504201637715423.xml 

Only mv for external tools

mv -v "$file" "${file:6}" 

Output

renamed '35554842200284685106000166550020003504201637715423.xml' -> '42200284685106000166550020003504201637715423.xml' 

Keeping the last 48 chars would be.

mv -v "$file" "${file:(-48)}" 
Add an answer for last 48 chars.
Source Link
Jetchisel
  • 1.6k
  • 9
  • 12

Here is one using bash specific P.E. parameter expansion.

file=35554842200284685106000166550020003504201637715423.xml 

Only mv for external tools

mv -v "$file" "${file:6}" 

Output

renamed '35554842200284685106000166550020003504201637715423.xml' -> '42200284685106000166550020003504201637715423.xml' 

Keeping the last 48 chars would be.

mv -v "$file" "${file:(-48)}" 

Here is one using bash specific P.E. parameter expansion.

file=35554842200284685106000166550020003504201637715423.xml 

Only mv for external tools

mv -v "$file" "${file:6}" 

Output

renamed '35554842200284685106000166550020003504201637715423.xml' -> '42200284685106000166550020003504201637715423.xml' 

Here is one using bash specific P.E. parameter expansion.

file=35554842200284685106000166550020003504201637715423.xml 

Only mv for external tools

mv -v "$file" "${file:6}" 

Output

renamed '35554842200284685106000166550020003504201637715423.xml' -> '42200284685106000166550020003504201637715423.xml' 

Keeping the last 48 chars would be.

mv -v "$file" "${file:(-48)}" 
Source Link
Jetchisel
  • 1.6k
  • 9
  • 12

Here is one using bash specific P.E. parameter expansion.

file=35554842200284685106000166550020003504201637715423.xml 

Only mv for external tools

mv -v "$file" "${file:6}" 

Output

renamed '35554842200284685106000166550020003504201637715423.xml' -> '42200284685106000166550020003504201637715423.xml'