Category Archives: Bash

Replace a substring in source file names

For example, the command below

find -name "*android*" -exec rename 's/android/windows/' {} \;

renames the following source files:

androidinappproduct.cpp
androidinappproduct.h
androidinapppurchasebackend.cpp
androidinapppurchasebackend.h
androidinapptransaction.cpp
androidinapptransaction.h
(more…)

Adding a header to source files

Put the header content into a text file and load it into a variable:

cd ~/temp/
nano h.txt
h=$(<h.txt)
(more…)