LoginSignup
7
6

More than 5 years have passed since last update.

ファイル一括検索・置換系の便利コマンド集

Last updated at Posted at 2015-12-10

よく忘れるので備忘録として記録しておく。

参考ページ

サブディレクトリ以下の特定の拡張子からのみ全文検索する

例: *.rb から hoge を検索する

find ./ -type f -name "*.rb" -print0 | xargs -0 grep hoge

サブディレクトリ以下の特定の拡張子を全て置換する

例: css -> scss に置換

find ./ -type f -name "*.css" -print0 | while read -r -d '' file; do mv "$file" "${file%.*}.scss"; done

rsync 便利コマンド集

サーバから特定日時以降のファイルのみ取得する

例: example.com から 2016-01-01 以降に更新されたファイルを全て取得する

rsync -aR -e ssh example.com:'`find /var/log/httpd -type f -newermt "2016-01-01 00:00:00"`' ./
7
6
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
7
6