Information Technology Grimoire

Version .0.0.1

IT Notes from various projects because I forget, and hopefully they help you too.

sed

Rename Files

From Namespace to MWNamespace

for fl in *.php; do
mv $fl $fl.old
sed 's/Namespace::/MWNamespace::/g' $fl.old > $fl
done

Add Line in all Files

The following will replace all files it finds with a new line after parent: Linux with:

`` parent: Linux grand_parent: Operating System

digitalcrunch@penguin:~/techgrimoire2/operating-system/linux$ sed -i.bak ‘/parent: Linux/a grand_parent: Operating System’ *


And the same for `parent: Windows`:

digitalcrunch@penguin:~/techgrimoire2/operating-system/linux$ cd .. digitalcrunch@penguin:~/techgrimoire2/operating-system$ cd windows/ digitalcrunch@penguin:~/techgrimoire2/operating-system/windows$ sed -i.bak ‘/parent: Windows/a grand_parent: Operating System’ *