Shared files

Started by certforumz, January 10, 2022, 07:23:49 AM

Previous topic - Next topic

certforumz

#301









certforumz

#310
How to update all pages in a website from 2002-2024 to 1002-2025 using ssh sed command:
find . -type f -name "*.html" -print0 | xargs -0 sed -i 's/2002-2024/2002-2025/g'
this command works.
1. login using ssh (putty app will do in windows 10/11)
2. login using your cpanel credentials
3. chnge to public_html directory using cd/public_html command. issue the following command to change the string
4. find . -type f -name "*.html" -print0 | xargs -0 sed -i 's/2002-2024/2002-2025/g'
The above command will string replace all the html files within the parent directory as well as sub directories in a second!!

PS: Note that if you just copy and paste from html file (replacement string) it might not work. paste it to notepad and then copy to the command!

good luck!

For simexams.com
find . -type f -name "*.htm" -print0 | xargs -0 sed -i.bak 's/2024 AnandSoft.com/2025 AnandSoft.com/g';

How to change single file using SED:
sed -i 's/2003-2024 TutorialsWeb.com/2003-2025 TutorialsWeb.com/g'; filename.html

With backup (takes backup of the file before making changes with .bak extension:
sed -i.bak 's/Copyright 2002-2024/Copyright 2002-2025/g' products.html


certforumz

find . -type f -name "*.html" -print0 | xargs -0 sed -i 's/2003-2024/2003-2025/g'
find . -type f -name "*.html" -print0 | xargs -0 sed -i.bak 's/2003-2024/2003-2025/g'
above does string replacement and takes backup prior to string replacement.
ls -d */ (displays only folders in pwd)