LoginSignup
0
1

More than 5 years have passed since last update.

Web DB Press のファイル名を一括変換する高性能スクリプト

Last updated at Posted at 2018-05-29

what

pdfの連番ファイル名を置換する

why

総集編1-102を買ってウハウハとタブレットに入れて読んでるがファイル名がvolNN.pdfとなっており、ゼロ詰めされてないのでソートしてウギャー

how

for file in webdb_vol??.pdf ; do
  if [[ ${file} =~ ^(.*vol)([0-9]+.pdf)$ ]]; then
    mv $file "${BASH_REMATCH[1]}0${BASH_REMATCH[2]}"
  fi
done

finally

  • ソートしてウギャーからの卒業
  • bashで正規表現
    • BASH_REMATCH[0]でマッチした全体が返る
  • 正規表現とか全言語共通になってほしい
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1