0

I have files in many directories that have the date Feb28 in them. I'd like to change them all to Mar2. For example, in one directory, I have

file1_Feb28_01.json
anothername_Feb28_02.txt

I want these to instead be

file1_Mar2_01.json
anothername_Mar2_02.txt

I have other similar files in other directories.

So far I have tried:

find . -name '*Feb28*' -type f -exec bash -c 'mv "$1" "{1/Feb28/Mar2}"' -- {} \;

And in a separate bash script, I have tried:

#!/bin/sh
echo "$1" | sed 's/*Feb28*$/*Mar1*/'

I found this, but it doesn't seem to directly answer my question.

Community
  • 1
  • 1
StatsSorceress
  • 3,019
  • 7
  • 41
  • 82

0 Answers0