Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I run the following command which comments out all lines that contain the text "dlclose"

grep -lIR "dlclose" . | grep -v ".svn" | xargs sed -i "s/.*dlclose.*/\/\/&/g"

However, sed claims that the piped files don't exist:

sed: can't read ./Utilities/src/DynLib.cpp: No such file or directory

This doesn't make any sense since grep was able to find and pipe the filename.

What is going on here? Is it piped in the wrong format?

Also, as a side note, I would like to merge the two greps, but I am forced to use grep 2.5.1 which doesn't have exclude-dir

share|improve this question
It works for me. Maybe adding "--verbose" or "-t" to the xargs switches to see exactly what xargs is trying to execute will help. – Mark Wagner Aug 11 '10 at 22:48
Works fine for me too so I do not know what else to suggest. – Richard Holloway Aug 11 '10 at 23:27

1 Answer 1

If the file is a symlink pointing to a non-existant file, that's the error you'll get.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.