Grep to the rescue
It was a dark cold night. I was sitting in my kitchen polishing some code I have been working on for the last 3-4 nights. The moon was shining through the window. The TV was on. I
started refactoring the most important part of the code and accidently …hit delete!
A scary howling goes through the night. “Don’t! Don’t be …gone!” A transformation into a wild animal happened …right in my kitchen. The creature was
about to destroy my laptop …only the blessed shine of the Linux OS let it refuse to touch it. In a haste I searched for a tool to defeat the monster. As it turns out all you need
is a grep.
It gave me back my little treasure and the creature turned back to normal.
So what’s the moral of the story? Do more backups!
Especially if you are about to refactor code that’s not yet under version control.
grep -a -A1 -B2000 /dev/hda1 | tr -cd '111240-176' | less