LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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, 06: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, 06:03 PM   #2
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
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 06:05 PM.
 
1 members found this post helpful.
Old 02-23-2012, 06:11 PM   #3
speigel205
LQ Newbie
 
Registered: Jan 2012
Posts: 18

Original Poster
Rep: Reputation: Disabled
Thank you
 
  


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 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 06:35 AM
Word search in files using Bash nnjond Linux - Newbie 1 10-09-2010 05:01 PM
[SOLVED] how to search word in group of files using command sumeet inani Linux - Newbie 20 11-09-2009 07: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 07:37 PM
search special files and copy in directory. abhi Linux - Newbie 2 04-10-2005 09:22 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:29 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
Open Source Consulting | Domain Registration