LiGenews

Tuesday, April 6, 2010

Change names of multiple files in a shell

Example: change all files whose name starts with "kIM" to "kIM_partial" with the same file type (.doc->.doc, .mat->.mat)

1. ls kIM* > namelist
2. cat namelist | awk '{c=split($0, s, "."); print "mv "$0" "s[1]"_partial."s[2]""}' | sh
Posted by genaldo10 at 10:34 AM No comments:
Newer Posts Older Posts Home
Subscribe to: Posts (Atom)

About Me

My photo
genaldo10
View my complete profile

Blog Archive

  • ►  2023 (1)
    • ►  December (1)
  • ►  2020 (1)
    • ►  December (1)
  • ►  2016 (1)
    • ►  October (1)
  • ►  2015 (2)
    • ►  May (1)
    • ►  February (1)
  • ►  2014 (2)
    • ►  July (2)
  • ►  2013 (6)
    • ►  June (3)
    • ►  May (2)
    • ►  April (1)
  • ►  2012 (4)
    • ►  July (1)
    • ►  February (2)
    • ►  January (1)
  • ►  2011 (3)
    • ►  December (1)
    • ►  November (1)
    • ►  October (1)
  • ▼  2010 (9)
    • ►  December (1)
    • ►  October (1)
    • ▼  April (1)
      • Change names of multiple files in a shell
    • ►  February (1)
    • ►  January (5)
  • ►  2009 (11)
    • ►  July (11)
Picture Window theme. Powered by Blogger.