Author: Victor Churchill Date: To: Hampshire LUG Discussion List Subject: Re: [Hampshire] grep -50 foo /dev/sda1 runs out of memory
Hi Hugo,
On 10 February 2011 20:19, Hugo Mills <hugo@???> wrote: >
> Possibly it's because the disk has large expanses of data with no
> LF characters in it. It's most likely to be zeroes or control
> characters, so I'd suggest something like:
>
> sudo tr -d \\000-\\011\\013-\\037 </dev/sda1 | grep -100 Vishal
>
> It's not guaranteed to work, but you might get lucky. :)
Giving it a go...
>
> If you actually saved it, have you tried looking for that text in
> extant files, rather than grepping the whole disk?
Well I *thought* I had saved it ;-)
I did try
find / -mmin -60 but was deluged with unexpected stuff from the /proc
and /dev file systems, and couldn't figure out how to use -prune so
gave up on that. But I suspect the file might have been deleted by the
Firefox plugin after I exited the editor. Hence trying a punt on
grepping the disc.
>
> Also, note that you're only going to get one line of the output
> with little or no indication of where in the disk it is, so you
> _still_ won't have the data -- just one line of it and no idea of
> where the rest is, so the above incantation probably isn't what you
> need. (I'm too tired right now to think of what it is that you _do_
> need, though; sorry. Maybe someone else can help with that).
> I believe 'grep -number' will give <number> lines of context around
the match. Like 'grep -A 100 -B 100".