#!/bin/sh
#
# This will grep a partition for a string, then pass the output to lde
# to hopefully produce and intact inode which can be used to recover 
# the file.
#
# USAGE:  grep-inode search_string device
#
SEARCH=$1
DEVICE=$2
# Might want to specify -i (case insensitve) or something
GREP_OPT=-i
# Might want to specify --all if the data was really important, but 
# if you've caught it early, it won't be necessary.
LDE_OPT=
# If you don't have awk, remove it from the command pipeline below.
# I don't think it was doing what I wanted it to anyways.
grep ${GREP_OPT} -b ${SEARCH} ${DEVICE} | awk '{FS = ":" } ; { print $1 }' | lde ${LDE_OPT} --grep ${DEVICE}
