On Fri, 2004-01-16 at 01:37, Nick Rout wrote: > (astute readers who do not delete my posts as a matter of course will > see the relevance of this to my undelete thread ;-) > > 1. grep -b is supposed to give me byte offsets into the file where the > pattern occurs. > > however: > > sf root # egrep Exif -b /dev/hdb3 > Binary file /dev/hdb3 matches > > no byte offsets. why?
Pass > 2. how do i use grep to find a hex pattern, eg FFD9 (which marks the end > of a jpeg file). I guess I have to escape it somehow, can anyone tell > me? (sorry i feel i should know this one, but i don't) I think you'll be be needing something like ngrep http://ngrep.sourceforge.net/ > 3. how do i truncate a file to n bytes long? I thought there was a > truncate command, but I may have the wrong name. That's the head command. I've been using head to cut a downloaded video file before the corrupt parts, then continue the download. The following will take the first 2 megabytes of file1 and write it out to file2 head -b 2m file1 > file2 -- Paul Wilkins
