From e63a3023e03ecf458385a0e8cef57419cea09885 Mon Sep 17 00:00:00 2001 From: Michele Cereda Date: Wed, 9 Nov 2022 01:26:48 +0100 Subject: [PATCH] Added rename to the KB --- knowledge base/rename.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 knowledge base/rename.md diff --git a/knowledge base/rename.md b/knowledge base/rename.md new file mode 100644 index 0000000..b593a89 --- /dev/null +++ b/knowledge base/rename.md @@ -0,0 +1,18 @@ +# `rename` + +> **Note:** this page refers to the command from the `util-linux` package on Linux or Homebrew's `rename` package. + +## TL;DR + +```sh +# Show what would change without changing anything (dry run). +rename -vn foo bar * + +rename -nv 's/^(\d{4}-\d{2}-\d{2}) (.*)$/$1 addition $2/' 'file' +``` + +## Sources + +- [cheat.sh] + +[cheat.sh]: https://cheat.sh/rename