LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-23-2012, 07:02 PM   #1
speigel205
LQ Newbie
 
Registered: Jan 2012
Posts: 18

Rep: Reputation: Disabled
Search files with a special word


Hi, I want to search all the files *.txt in the directory /home to find files that contains the word "tag" like xytag or Tag123 or /tAg. Regards
 
Old 02-23-2012, 07:03 PM   #2
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,258

Rep: Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947
Code:
grep -i tag /home/*.txt
If you want it to be a recursive search (including .txt files inside subdirectories), you can use find:

Code:
find /home/ -iname "*.txt" | xargs grep -i tag

Last edited by suicidaleggroll; 02-23-2012 at 07:05 PM.
 
1 members found this post helpful.
Old 02-23-2012, 07:11 PM   #3
speigel205
LQ Newbie
 
Registered: Jan 2012
Posts: 18

Original Poster
Rep: Reputation: Disabled
Thank you
 
  


Reply


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Search word and delete only the word and the line using Sed command kbmukesh Linux - Newbie 4 06-28-2011 07:35 AM
Word search in files using Bash nnjond Linux - Newbie 1 10-09-2010 06:01 PM
[SOLVED] how to search word in group of files using command sumeet inani Linux - Newbie 20 11-09-2009 08:46 AM
I have a harddrive that I want to search for deleted word files, what do I do first? abefroman Linux - Security 2 07-31-2005 08:37 PM
search special files and copy in directory. abhi Linux - Newbie 2 04-10-2005 10:22 AM


All times are GMT -5. The time now is 08:34 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration