re-suffix file in linux

You have a directory of several hundred “.jpg” files, which for some reason you need to re-suffix “.jpeg”. What do you do?

Ans: 
find . -maxdepth 1 -type f -name "*.jpg" | while read file; do NEW=`echo ${file} | sed "s/.jpg/.jpeg/"`; mv ${file} ${NEW}; done
OTHER ANS: 
for file in *.jpg ; do mv $file `echo $file | sed -e 's/jpg$/jpeg/'`; done
OTHER ANS: 
for file in *.jpg ; do mv $file ${file/.jpg/.jpeg} ; done
OTHER ANS(without a loop): 
find ./ -name "*jpg" | sed "s/.jpg$//" | xargs -Iblah mv blah.jpg blah.jpeg
OTHER ANS: 
rename 's/\.jpg$/.jpeg/' *

You have a text file of ASINs  one to a line.ASINs  may repeat. How do you get a unique list of allASINs that start with ‘B’, end with 3 digits, etc?


In a given text file, replace all instances of “a savings of X%” with “(X% off)”, where ‘X’ represents an actual percentage.


 


Here’s one from the admin perspective:

What is your procedure for doing an emergency reboot?

http://www.cyberciti.biz/tips/reboot-or-halt-linux-system-in-emergency.html