LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 12-02-2002, 03:41 PM   #1
jamesmwlv
LQ Newbie
 
Registered: Dec 2002
Posts: 5

Rep: Reputation: 0
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
 
Old 12-02-2002, 06:33 PM   #2
bulliver
Senior Member
 
Registered: Nov 2002
Location: Edmonton AB, Canada
Distribution: Gentoo x86_64; Gentoo PPC; FreeBSD; OS X 10.9.4
Posts: 3,760
Blog Entries: 4

Rep: Reputation: 78
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. . .
 
Old 12-02-2002, 07:13 PM   #3
stickman
Senior Member
 
Registered: Sep 2002
Location: Nashville, TN
Posts: 1,552

Rep: Reputation: 53
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help parsing text file scilec Programming 5 12-02-2004 01:00 PM
need help parsing text file airman99 Linux - General 2 10-08-2004 09:09 PM
Parsing large text file with perl smaida Programming 5 09-13-2004 04:33 AM
Parsing Text from a html file. Rezon Programming 6 10-18-2003 12:09 AM
Parsing a tab delimited text file jajanes Programming 9 08-08-2003 10:34 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:46 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration