Searching for text in files


 
Thread Tools Search this Thread
Operating Systems Linux Searching for text in files
# 1  
Old 01-21-2004
Searching for text in files

Is there anyway that I can run a search of all files for matching strings(or even just a subset of all files) from the command line on Linux system? e.g check all files in the current directory that have 'cisco' in them........

find doesnt seem to be right as it only(well it appears to me anyway!) searches for files(true?)

Help me....... please??!! Smilie

-------------------------------------------------------------
'Just say to the new guy "STFU, STFD & RTFM!!"'
# 2  
Old 01-21-2004
The command you want is called "grep". To search all files in the current directory...

grep 'cisco' *

More info:"how to use grep"
# 3  
Old 01-21-2004
Thanks Ygor..... Much appreciated!!

As you can probably gather, I'm relatively new to the whole Linux/UNIX OS area........: eek:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need help searching through a text file.

I'm trying to get one specific number out of a text file, in order to use as part of an algorithm in a shell script. It will always come after a specific string and that string won't appear anywhere else in the file. So I'm trying to search through the file for that one string, then grab the... (2 Replies)
Discussion started by: mikedigornio
2 Replies

2. Shell Programming and Scripting

searching a file with a specified text without using conventional file searching commands

without using conventional file searching commands like find etc, is it possible to locate a file if i just know that the file that i'm searching for contains a particular text like "Hello world" or something? (5 Replies)
Discussion started by: arindamlive
5 Replies

3. Shell Programming and Scripting

searching a text string for n'th :

hello, i'm a novice on bsh scripting so thanks for any help here basically i have a shell var $x that looks like this > echo $x nabc1234:!:73394:17155:Gary Mason:/home/garym:/bin/ksh and i'm trying to keep the first 8 characters and the text from the 4th : to the 5th : i've been trying... (9 Replies)
Discussion started by: sasglm
9 Replies

4. UNIX for Advanced & Expert Users

Searching filenames containing certain text???

Suppose there are multiple files containing certain text "abc". How to print the name of all such files with a single command from unix prompt? Thanks in advance (6 Replies)
Discussion started by: skyineyes
6 Replies

5. Shell Programming and Scripting

Searching and extracting text from output

I have the following output which I need to obtain the values for "Next Seq is xxx" and "Last Seq is xxx" and "Pending count is xxx". You will notice that the number of words prior to that value can be variable hence the reason for asking this question. LINECMD> Line /xxx///ABC9_SND is UP.... (3 Replies)
Discussion started by: sjday
3 Replies

6. UNIX for Dummies Questions & Answers

Hi! Searching for a text string in UNIX

Hi! I'm new here and glad to meet everyone! I've been wrestling with a problem lately however! How do I recursively (recursive means to keep going through the subdirectories until no more are there) search a bunch of textfiles in a long directory structure for a specific string.. but only... (1 Reply)
Discussion started by: skwadim
1 Replies

7. UNIX for Dummies Questions & Answers

Searching directory for file that contains some text.

If I go into a directory and type in .. more * | grep foo I get the lines of text that contain foo in all of the files in the directory out of all of the files that are there. How do I make it so I can find out what the names of the files are that contain that text "foo"? By doing what I... (4 Replies)
Discussion started by: LordJezo
4 Replies

8. UNIX for Dummies Questions & Answers

searching text files on specific columns for duplicates

Is it possible to search through a large file full of rows and columns of text and retrieve only the rows that contain duplicates fields, searchiing for duplicates on col4 & col6 Sample below Col1 col2 col3 col4 col5 col6 G405H SURG FERGUSON ... (2 Replies)
Discussion started by: Gerry405
2 Replies

9. UNIX for Dummies Questions & Answers

searching text question

If I am searching through a text file, and it is setup in hierarchical fashion. ie: Memory: 256 MB DDR Kingston CPU: UltraSparc 800 Mhz can i somehow search for CPU and pull out lines below it as well? Like grep only pulls that one line, i want that line... (4 Replies)
Discussion started by: BG_JrAdmin
4 Replies

10. Shell Programming and Scripting

Help with searching a text file

Hello all! I've been working for days on this and it is really bugging me!! Here's my dilemma: Say I have a very large text file which contains fields delimited my a ':' which logs various records. Each record is separated by a newline character, therefore I can search for lines with... (6 Replies)
Discussion started by: thekid2
6 Replies
Login or Register to Ask a Question