Need some really Unix-y help w/basic commands ... [View all]
OK, I'm not a Unix guru, but I did enough with Unix in my earlier days to learn the basics of stdin, stdout, pipes, etc. Now I'm trying to extraxt data from (hundreds of) files that were recovered from a partition whose directory was overwritten. I'm frustrated to find basic programs like grep aren't functioning as described on some Linux distros. What I really need to do is extract hex data from the 17-20th and 57-60th bytes of each file and print out a list of the data together with the name of the appropriate file. To view just one file I can use
hexdump <filename> | head -4
and from there visually extract the bytes. But to do this on a large scale, I tried
hexdump * | head -4 > <filename>
and only got data from the first file. I was able to locate data with grep but the -H option (print file name) isn't implemented in some Linux distros. Any suggestions? The least I need is a list of those bytes in the same order as the filenames (with none omitted); I could patch those together in a GUI word processor. At best, I'd like to list filename, long int, long int after interpreting those bytes, but again that's something I can kluge if it's too hard to do with the CLI.
BTW, I think I've already found the most important files by trial and error but I'd like to be sure, and be prepared if this should happen again. I.e., it's not all that urgent and I wouldn't want anyone to knock themselves out over it.