0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

renameコマンドのインストールと使い方

Last updated at Posted at 2025-06-24

記事の目的

ubuntu 22.04.5でrenameコマンドを使う際の備忘録として作成しました。

1. インストール

下記コマンドを実行

sudo apt install rename

2. 実行

基本構文:

rename "s/(置換対象文字列)/(置換後文字列)/" ファイル名

文字列の指定、ファイル名の指定には正規表現を使用できます

実行例

カレントディレクトリ内が下記内容のとき

before_00001.txt
before_00002.txt

下記コマンドを実行すると、

rename "s/before_\d\d\d/after_/" *.txt

次のようになる

after_01.txt
after_02.txt

以上です。

0
0
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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?