Skip to main content
Commonmark migration
Source Link

If you have access to the perl script rename you could also use

rename -n 's/(.*).{14}(\.png)/$1$2/' *

Remove -n after testing to actually rename the files.

###Notes

Notes

  • -n print what will be changed, don't actually do anything
  • s/old/new replace old with new
  • (.*) save any characters in this position for later
  • .{14} exactly 14 characters
  • (\.png) save .png
  • $1$2 print the first saved pattern and the second saved pattern

If you have access to the perl script rename you could also use

rename -n 's/(.*).{14}(\.png)/$1$2/' *

Remove -n after testing to actually rename the files.

###Notes

  • -n print what will be changed, don't actually do anything
  • s/old/new replace old with new
  • (.*) save any characters in this position for later
  • .{14} exactly 14 characters
  • (\.png) save .png
  • $1$2 print the first saved pattern and the second saved pattern

If you have access to the perl script rename you could also use

rename -n 's/(.*).{14}(\.png)/$1$2/' *

Remove -n after testing to actually rename the files.

Notes

  • -n print what will be changed, don't actually do anything
  • s/old/new replace old with new
  • (.*) save any characters in this position for later
  • .{14} exactly 14 characters
  • (\.png) save .png
  • $1$2 print the first saved pattern and the second saved pattern
edited body
Source Link
Zanna
  • 3.7k
  • 1
  • 20
  • 28

If you have access to the perl script rename you could also use

rename -n 's/([^-])-.*).{14}(\.png)/$1$2/' *

Remove -n after testing to actually rename the files.

###Notes

  • -n print what will be changed, don't actually do anything
  • s/old/new replace old with new
  • (.*) save any characters in this position for later
  • .{14} exactly 14 characters
  • (\.png) save .png
  • $1$2 print the first saved pattern and the second saved pattern

If you have access to the perl script rename you could also use

rename -n 's/([^-])-.*(\.png)/$1$2/' *

Remove -n after testing to actually rename the files.

If you have access to the perl script rename you could also use

rename -n 's/(.*).{14}(\.png)/$1$2/' *

Remove -n after testing to actually rename the files.

###Notes

  • -n print what will be changed, don't actually do anything
  • s/old/new replace old with new
  • (.*) save any characters in this position for later
  • .{14} exactly 14 characters
  • (\.png) save .png
  • $1$2 print the first saved pattern and the second saved pattern
Source Link
Zanna
  • 3.7k
  • 1
  • 20
  • 28

If you have access to the perl script rename you could also use

rename -n 's/([^-])-.*(\.png)/$1$2/' *

Remove -n after testing to actually rename the files.