Grep and xargs: File name too long

Solution 1:

Take out the -0 argument and it will fix this problem. the -0 arg to xargs says that the items in the input list are null terminated. You aren't doing that, you are passing lines terminated by an \n character.