search for certain word in a files from directory


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers search for certain word in a files from directory
# 1  
Old 10-31-2006
search for certain word in a files from directory

hi

can i know how to get the file name of any files containing for example "abc" from a number of files in a directory?
i tried "ls -ltrc | grep abc" but no resulted generated.

thanks in advance.
# 2  
Old 10-31-2006
perhabs:

# grep abc * | awk -F\: '{print $1}' | uniq

regards pressy
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Delete all files if another files in the same directory has a matching occurrence of a specific word

he following are the files available in my directory RSK_123_20141113_031500.txt RSK_123_20141113_081500.txt RSK_126_20141113_041500.txt RSK_126_20141113_081800.txt RSK_128_20141113_091600.txt Here, "RSK" is file prefix and 123 is a code name and rest is just timestamp of the file when its... (7 Replies)
Discussion started by: kridhick
7 Replies

2. Linux

How to search in ms word files and pdf's

Hi, Please let me know if there is a unix command or any shell script which can do a search for a text in ms-word files, pdf'd and in excel files. Please let me know if there is a solution for this challenge. Thanks, Kesava. (4 Replies)
Discussion started by: kesava
4 Replies

3. Shell Programming and Scripting

Find and replace a word in all the files (that contain the word) under a directory

Hi Everyone, I am looking for a simple way for replacing all the files under a directory that use the server "xsgd1234dap" with "xsdr3423pap". For Example: In the Directory, $pwd /home/nick $ grep -l "xsgd1234dap" *.sh | wc -l 119 I have "119" files that are still using... (5 Replies)
Discussion started by: filter
5 Replies

4. Solaris

How to search for a word in multiple files

Hi, I want to find for a particular word which is existing in different files and folders under the parent directory. What command can I use to retrieve all the file names which is having the word. (1 Reply)
Discussion started by: rogerben
1 Replies

5. UNIX for Dummies Questions & Answers

Script to search for a particular word in files and print the word and path name

Hi, i am new to unix shell scripting and i need a script which would search for a particular word in all the files present in a directory. The output should have the word and file path name. For example: "word" "path name". Thanks for the reply in adv,:) (3 Replies)
Discussion started by: virtual_45
3 Replies

6. Shell Programming and Scripting

Search entire system for files containing certain word(s)

I am trying to create a script that will report (email and ftp results) on any file, system wide, that has the word password= in it. (and any variation of password=). Basicaly looking for any plain text passwds. I figured the easiest way would be like this...... for i in `cat find-pw.dat` do... (6 Replies)
Discussion started by: theninja
6 Replies

7. Shell Programming and Scripting

Delete all files if another files in the same directory has a matching occurence of a specific word

Hello, I have several files in a specific directory. A specific string in one file can occur in another files. If this string is in other files. Then all the files in which this string occured should be deleted and only 1 file should remain with the string. Example. file1 ShortName "Blue... (2 Replies)
Discussion started by: premier_de
2 Replies

8. UNIX for Dummies Questions & Answers

How to find a word in a all the files in a Directory??

I want to find a specific word present in all the files ina directory....Please tell me the command to be used?? Thanks (6 Replies)
Discussion started by: shikhakaul
6 Replies

9. Shell Programming and Scripting

How can i open a directory and search a word using awk....

Hi guys,I m new one in awk scripting....i want to search a word with in a directory...in that directory haviing many files...if i give a work ,it should open the directory and open each file for to search that particular word....is it possible in awk...tell me guys its really urgent.... (2 Replies)
Discussion started by: stalin2020
2 Replies

10. UNIX for Dummies Questions & Answers

How to search files containing a specific word in the content

Hi all, Lets say I have 3 files a.txt and b.txt and c.txt. a.txt has the following text ==================== apple is good for health b.txt has the following text ==================== apple is pomme in french c.txt has the following text ==================== orange has citric acid... (1 Reply)
Discussion started by: amjath78
1 Replies
Login or Register to Ask a Question