awk - Troubleshooting 'grep: line too long' -


i have file must have 1 or more "too long" lines in it: when grep get

grep: line long 

there a number of posts on site recommending alternatives, none of working me. there way me identify , eliminate long lines in file, or strategy breaking file smaller files try , isolate long line(s)?

here sample of commands i've tried based upon other posts:

$ cat myfile | grep -no 'mytext' > out.txt $ grep 'mytext' myfile > out.txt 

the file's size 3367005608, relevant trying use zgrep initially, ran same issues. 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 

try stripping out null bytes first file:

tr -d '\000' < filewithnulls > nonulls 

and try running grep or awk nonulls file.


Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -

c# - String.format() DateTime With Arabic culture -