I found some info to help me recover an overwritten file. It was overwritten by using rsync in the wrong direction after making a bunch of changes. Following the info I found, I type this to see a lot of entries containing the text of my script:
root@ip-172-31-18-244:/code/sc# grep -a -b "package sc::object::cron::qbo" /dev/xvda1
<snip>
874419155:package sc::object::cron::qbo;
<snip>
After that, the next step is supposed to be as follows, but I am receiving an error:
root@ip-172-31-18-244:~/recover# dd if=/dev/xvda1 count=1 skip=$(expr 874419155 512)
expr: syntax error
dd: invalid number ââ
Can anyone help me accomplish recovery of the file? The file was changed yesterday, I was backing up using rsync and made the critical mistake this morning before starting more work on the script. This is on an Ubuntu 14.04.1 LTS server.