Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - General
User Name
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.


  Search this Thread
Old 06-01-2003, 08:08 PM   #1
Registered: Jun 2001
Location: 28N,82W
Distribution: XP,Ubuntu 9
Posts: 473

Rep: Reputation: 30
Question How to find text in a set of files?

I want to know where HOSTNAME value is assigned.
So, I will need to find out the exact file (with line number) where the value is set. I know we can use grep to do that, but dunno how.
Can someone help?
Old 06-01-2003, 08:28 PM   #2
Senior Member
Registered: Dec 2002
Location: Atlantic City, NJ
Distribution: Ubuntu & Arch
Posts: 3,503

Rep: Reputation: 57
If you want to check the /etc directory files and all of the subdirectories files as well for the string hostname you would do:

grep -R HOSTNAME /etc/*

I don't know what the switch is for identifying the line it is on though.
Old 06-01-2003, 08:36 PM   #3
Senior Member
Registered: Dec 2002
Location: England
Distribution: Used to use Mandrake/Mandriva
Posts: 2,794

Rep: Reputation: 116Reputation: 116
Either in /etc/hostname, or /etc/rc.d/rc.sysinit line 30


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
How to find files containing specific text? SurfTurtle Linux - Newbie 7 01-05-2008 06:57 AM
How to find a work within a folder full of text files? juanb Linux - General 4 05-03-2005 05:09 PM
linux 'find' to find text files subu_s Programming 2 12-02-2004 03:56 AM
find files in text-only? orange400 Linux - General 2 05-27-2004 08:50 AM
Find string pattern in directory of text files magnum818 Linux - Newbie 2 10-15-2003 09:19 PM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:48 AM.

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