osx bash grep - finding search terms in a large file with one single line

Posted by unsynchronized on Super User See other posts from Super User or by unsynchronized
Published on 2014-06-04T23:50:44Z Indexed on 2014/06/05 3:29 UTC
Read the original article Hit count: 429

Filed under:
|
|
|

Is there simple unix command line i can enter which lets me isolate say 512 bytes either side of a search term, even if there is only one "line" in a very large text file?

Ok, this should be easy.

Famous last words.

I'm not that familiar with grep, but it seems it is mainly used to filter out lines in the input that contain search terms.

I have a very large json file that I downloaded that i want to search for a particular term.

before you click the link - it's over 244MB so be warned - it is from the internet wayback machine and contains lists of zip files of archived photos. i am trying to find mine.

Their web interface is broken, so i found the json file that they make public here - it's the last one on the list.

when i grep looking for my username, it finds it, but proceeds to dump that line to the console. the problem is that line is 244MB long, and it's the only line in the file.

i tried using less, but could not get that to do much - it's very slow, and seems to have the same issue.

is there simple unix command line i can enter which lets me isolate say 512 bytes either side of a search term?

© Super User or respective owner

Related posts about osx

Related posts about command-line