From b7e697449749b50758bef118274eddcd2021c41e Mon Sep 17 00:00:00 2001 From: James Ononiwu Date: Thu, 9 Mar 2023 12:38:29 +0100 Subject: [PATCH 1/3] Added find bash script for file extensions script finds and replaces file extensions and also replaces link extensions in files with a particular extension --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index db3aac2..cec0028 100644 --- a/README.md +++ b/README.md @@ -2148,6 +2148,18 @@ find . -depth -name '*test*' -execdir bash -c 'mv -v "$1" "${1//foo/bar}"' _ {} find / \( -perm -4000 -o -perm -2000 \) -type f -exec ls -la {} \; ``` +###### Recursively find/replace files extension ext1 with ext2 + +```bash +find . -name "*.ext1" | while read i; do mv "$i" "${i%.ext1}.ext2"; done +``` + +###### Recursively find/replace link extension ext1 with ext2 in files of extension ext + +```bash +find . -name '*.ext' -exec sed -i 's/\.ext1/\.ext2/g' "{}" \; +``` + ___ ##### Tool: [top](https://en.wikipedia.org/wiki/Top_(software)) From e2fc27ac661303e19764a37512330dd3d5751848 Mon Sep 17 00:00:00 2001 From: James Ononiwu Date: Thu, 9 Mar 2023 13:10:41 +0100 Subject: [PATCH 2/3] Added find bash script for file extensions --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index cec0028..d00a611 100644 --- a/README.md +++ b/README.md @@ -2154,7 +2154,7 @@ find / \( -perm -4000 -o -perm -2000 \) -type f -exec ls -la {} \; find . -name "*.ext1" | while read i; do mv "$i" "${i%.ext1}.ext2"; done ``` -###### Recursively find/replace link extension ext1 with ext2 in files of extension ext +###### Recursively find/replace link extension ext1 with ext2 in files with extension ext ```bash find . -name '*.ext' -exec sed -i 's/\.ext1/\.ext2/g' "{}" \; From 188ca9ef3ea3635af2ed24454c412ca7f759be98 Mon Sep 17 00:00:00 2001 From: James Ononiwu Date: Thu, 9 Mar 2023 13:13:29 +0100 Subject: [PATCH 3/3] Added find bash script for file extensions - signed-off-by: James Ononiwu --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d00a611..d17ee7c 100644 --- a/README.md +++ b/README.md @@ -2154,7 +2154,7 @@ find / \( -perm -4000 -o -perm -2000 \) -type f -exec ls -la {} \; find . -name "*.ext1" | while read i; do mv "$i" "${i%.ext1}.ext2"; done ``` -###### Recursively find/replace link extension ext1 with ext2 in files with extension ext +###### Recursively find/replace links extension ext1 with ext2 in files with extension ext ```bash find . -name '*.ext' -exec sed -i 's/\.ext1/\.ext2/g' "{}" \;