Format of SED command to change a date

I have a website. I have a directory within it with over a hundred .html files. I need to change a date within every file. I don't have an easy way to find/replace.

I need to change 10/31 to 11/30 on every single page at once. I tried the command below but it didn't work. Obviously I don't know what I'm doing so any help would be appreciated.

/home/public_html/content$ sed '"10/31"/"11/30"'/g *

Try:

for f in *; do
  cp -p "$f" "$f.old" && sed 's|10/31|11/30|g' "$f.old" > "$f"
done

or GNU:

sed -i.old 's|10/31|11/30|g' *
1 Like
find directory -type f -name "*.html" -exe sed -i.old 's|10/31|11/30|g'  {} \;

If your sed don't support -i option, replace by perl

find directory -type f -name "*.html" -exec perl -p -i.old -e 's|10/31|11/30|g'  {} \;
1 Like

Thanks for everyone's reply. The first one worked, so I just went with that. I will just run that once a month to change the date.