Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. find drp/ -depth -name "*abc.tab" -exec rename 's/abc.tab$/xyz.tab/' {} +
  2.  
  3. rename 's/^[*]+/sprintf("%d_", length $&)/e' -vn *
  4.  
  5. $ touch *{,*{,*}}abc.tab
  6. $ rename 's/^[*]+/sprintf("%d_", length $&)/e' -vn *
  7. ***abc.tab renamed as 3_abc.tab
  8. **abc.tab renamed as 2_abc.tab
  9. *abc.tab renamed as 1_abc.tab
  10.  
  11. $ rename 's/^[*]+/sprintf("%d_", length $&)/e; s/abc/xyz/' -vn *
  12. ***abc.tab renamed as 3_xyz.tab
  13. **abc.tab renamed as 2_xyz.tab
  14. *abc.tab renamed as 1_xyz.tab
  15.  
  16. python3 path/to/rename.py </path/to/files>
  17.  
  18. ****banana.txt
  19. **monkey.mp3
  20. **************test
  21.  
  22. 4_banana.txt
  23. 2_monkey.mp3
  24. 14_test
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement