Is there a grep-like tool for windows where I can restrict the number of characters it outputs in a line where a searched for pattern is found.
One of the upstream software systems generates huge text files which we then feed as the input to our system.
Sometimes the input files get corrupted and I need to do a quick textual search to find if particular the bits of data are missing or not. To make it even worse – the input files is just one very very long line of text – and when I use grep or findstr – the result of the search is huge chunk of text.
I am wandering – how can I limit the number of characters grep to show before/after the pattern I searched for.
Cheers.
Two things spring to my mind:
--only-matchingoption so that only the text that matches is emitted. Depending on your regex, this may or may not help.The latter option is relatively simple. If you didn’t want to go the whole hog and produce a proper native exe it could be quite easily achieved with a Perl/Python/Ruby etc. script.