Click to See Complete Forum and Search --> : grep and copy to file?


venus86
09-11-2001, 02:39 PM
i need to grep for something in a file and have it print the output to a text file in my home directory. i can't for the life of me figure out how to do this.

i'm in /etc/httpd/conf directory trying:
grep .com httpd.conf | cp /home/venus/com.txt
said no destination, that's true...
grep .com httpd.conf | /home/venus/com.txt
broken pipe...

yet if i do just grep .com httpd.conf it works but prints to the screen.

i know this has got to be simple to do. i thought it would create the .txt file on the fly but when i got errors i even went in and created a blank com.txt file for it to write to but nothings worked.

can anyone please help?

venus86
09-11-2001, 02:53 PM
wait! i figured it out,

grep .com httpd.conf>com.txt

thanks anyway!