Troubleshooting 'grep: line too long'
awk, grep
Solution
Try stripping out all null bytes first from your file:
tr -d '\000' < fileWithNulls > noNulls
And then try running your grep or awk with `noNulls` file.
Problem
I have a file that must have one or more "too long" lines in it: when I `grep` it I get ``` grep: line too long ``` There are a number of posts on this site recommending alternatives, none of which are working for me. Is there some way for me to identify and eliminate the long lines in the file, or a strategy for breaking the file into smaller files to try and isolate the too long line(s)? Here is a sample of the commands I've tried based upon the other posts: ``` $ cat myFile | grep -no 'myText' > out.txt $ grep 'myText' myFile > out.txt ``` The file's size is 3367005608, which is probably only relevant as I was trying to use `zgrep` initially, but ran into the same issues. I get the following error ``` awk: cmd. line:1: (FILENAME=myFile FNR=1) fatal: set_record: databuf: can't allocate 2147483648 bytes of memory (Cannot allocate memory) ``` when using `awk` ``` awk '/myText/' myFile > out.txt ```