LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Parsing a file for a string of text (https://www.linuxquestions.org/questions/linux-general-1/parsing-a-file-for-a-string-of-text-37103/)

jamesmwlv 12-02-2002 03:41 PM

Parsing a file for a string of text
 
I need to parse all the files on my system to one that includeds the following string of text, "echo 1 > /proc/sys/net/ipv4/ip_forward". I have checked all the normal files where it should have been placed.

I have tried grep but I guess i did not use it properly,
grep / <echo 1 > /proc/sys/net/ipv4/ip_forward>

Thanks
James Wadkins
james@vtat.com

bulliver 12-02-2002 06:33 PM

Ok, I think your problem is that you are only searching your root "/" directory with the command "grep / <echo 1 > /proc/sys/net/ipv4/ip_forward>" If you want to seach your entire filesystem add the recursive flag, ie:
grep -r / <echo 1 > /proc/sys/net/ipv4/ip_forward>
I also don't think you need the square brackets "< and >" around the line you are trying to locate.
Hope this helps. . .

stickman 12-02-2002 07:13 PM

It's resource intensive, but something like the following should work:
find / -type f -exec grep -H "echo 1 > /proc/sys/net/ipv4/ip_forward" {} \;

I suspect that you're trying to find out where forwarding gets turned on. I didn't see a distribution mentioned, but /etc/init.d should be a good place to start looking. I would suspect that it should be somewhere in /etc for your distro. My /etc/init.d/ipsec has something similar to this in it.


All times are GMT -5. The time now is 12:11 PM.