Skip to main content
Became Hot Network Question
added 346 characters in body
Source Link
devegili
  • 109
  • 1
  • 5

I have a file named 35554842200284685106000166550020003504201637715423.xml and I simply need to rename it to 42200284685106000166550020003504201637715423.xml (remove everything before the last 48 characters). This simple regular expression (.{48}$) can extract the last 48 characters, but I can't make it work using rename in Bash.

How can I use rename and this regular expression to rename it to only the last 48 characters?

Edit:

Output of rename --help

rename --help

[root@ip-000-00-0-000 tmp]# rename --help Usage: rename [options] <expression> <replacement> <file>... Rename files. Options: -v, --verbose explain what is being done -s, --symlink act on the target of symlinks -n, --no-act do not make any changes -h, --help display this help and exit -V, --version output version information and exit For more details see rename(1). 

Thank you.

I have a file named 35554842200284685106000166550020003504201637715423.xml and I simply need to rename it to 42200284685106000166550020003504201637715423.xml (remove everything before the last 48 characters). This simple regular expression (.{48}$) can extract the last 48 characters, but I can't make it work using rename in Bash.

How can I use rename and this regular expression to rename it to only the last 48 characters?

Edit:

Output of rename --help

rename --help

Thank you.

I have a file named 35554842200284685106000166550020003504201637715423.xml and I simply need to rename it to 42200284685106000166550020003504201637715423.xml (remove everything before the last 48 characters). This simple regular expression (.{48}$) can extract the last 48 characters, but I can't make it work using rename in Bash.

How can I use rename and this regular expression to rename it to only the last 48 characters?

Edit:

Output of rename --help

[root@ip-000-00-0-000 tmp]# rename --help Usage: rename [options] <expression> <replacement> <file>... Rename files. Options: -v, --verbose explain what is being done -s, --symlink act on the target of symlinks -n, --no-act do not make any changes -h, --help display this help and exit -V, --version output version information and exit For more details see rename(1). 

Thank you.

added 114 characters in body
Source Link
devegili
  • 109
  • 1
  • 5

I have a file named 35554842200284685106000166550020003504201637715423.xml and I simply need to rename it to 42200284685106000166550020003504201637715423.xml (remove everything before the last 48 characters). This simple regular expression (.{48}$) can extract the last 48 characters, but I can't make it work using rename in Bash.

How can I use rename and this regular expression to rename it to only the last 48 characters?

Edit:

Output of rename --help

rename --help

Thank you.

I have a file named 35554842200284685106000166550020003504201637715423.xml and I simply need to rename it to 42200284685106000166550020003504201637715423.xml (remove everything before the last 48 characters). This simple regular expression (.{48}$) can extract the last 48 characters, but I can't make it work using rename in Bash.

How can I use rename and this regular expression to rename it to only the last 48 characters?

Thank you.

I have a file named 35554842200284685106000166550020003504201637715423.xml and I simply need to rename it to 42200284685106000166550020003504201637715423.xml (remove everything before the last 48 characters). This simple regular expression (.{48}$) can extract the last 48 characters, but I can't make it work using rename in Bash.

How can I use rename and this regular expression to rename it to only the last 48 characters?

Edit:

Output of rename --help

rename --help

Thank you.

edited tags
Link
Chris Davies
  • 128.4k
  • 16
  • 179
  • 324
Source Link
devegili
  • 109
  • 1
  • 5
Loading