Welcome to DU! The truly grassroots left-of-center political community where regular people, not algorithms, drive the discussions and set the standards. Join the community: Create a free account Support DU (and get rid of ads!): Become a Star Member Latest Breaking News Editorials & Other Articles General Discussion The DU Lounge All Forums Issue Forums Culture Forums Alliance Forums Region Forums Support Forums Help & Search

Open Source and Free Software

Showing Original Post only (View all)

eppur_se_muova

(38,460 posts)
Sat Oct 17, 2015, 11:18 PM Oct 2015

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.

3 replies = new reply since forum marked as read
Highlight: NoneDon't highlight anything 5 newestHighlight 5 most recent replies
Latest Discussions»Culture Forums»Open Source and Free Software»Need some really Unix-y h...»Reply #0