How can i use grep to search a specific pattern?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How can i use grep to search a specific pattern?
# 1  
Old 06-21-2013
How can i use grep to search a specific pattern?

Hi All,

My file contain the below data :
Code:
w_SA_infa1.log:INFO : LM_36620 : () Command task instance [Cmd_FILE_CHECK]: running command [Command1], with command value [sh -c "sh /data/.... "].
Binary file w_SA_infa1.log.bin matches
w_SA_infa2.log:INFO : LM_36620 : (30377|1427806528) Command task instance [Cmd_FILE_CHECK]: running command [Command1], with command value [sh -c "sh /data/...."].
Binary file w_SA_infa2.log.bin matches

I need from the file only the .log string .ie: w_SA_infa1.log and w_SA_infa2.log
I can have more values also.
Need the string with pattern .log from the file
# 2  
Old 06-21-2013
Which do you need and what have you tried so far?
Code:
w_SA_infa1.log:INFO : LM_36620 : () Command task instance [Cmd_FILE_CHECK]: running command [Command1], with command value [sh -c "sh /data/.... "].
Binary file w_SA_infa1.log.bin matches

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to use a grep search to search for a specific string within multiple directories?

Lets say I have a massive directory which is filled with other directories all filled with different c++ scripts and I want a listing of all the scripts that contain the string: "this string". Is there a way to use a grep search for that? I tried: grep -lr "this string" * but I do not... (3 Replies)
Discussion started by: Circuits
3 Replies

2. UNIX for Beginners Questions & Answers

Grep/awk using a begin search pattern and end search pattern

I have this fileA TEST FILE ABC this file contains ABC; TEST FILE DGHT this file contains DGHT; TEST FILE 123 this file contains ABC, this file contains DEF, this file contains XYZ, this file contains KLM ; I want to have a fileZ that has only (begin search pattern for will be... (2 Replies)
Discussion started by: vbabz
2 Replies

3. Shell Programming and Scripting

Shell Scripting , need to search and print a line that contains a specific pattern

Take example of below file. abc.txt nas1:/abc/test/test1 /test nas1:/abc/test/test1/test2 /test/abc nas1:/abc/test/ Now i have a variable that contains "nas1:/abc/test/test1" value , so i need to search the above file for this variable and print only this line. ... (14 Replies)
Discussion started by: mohit_vardhani
14 Replies

4. Shell Programming and Scripting

Search for duplicates and delete but remain the first one based on a specific pattern

Hi all, I have been trying to delete duplicates based on a certain pattern but failed to make it works. There are more than 1 pattern which are duplicated but i just want to remove 1 pattern only and remain the rest. I cannot use awk '!x++' inputfile.txt or sed '/pattern/d' or use uniq and sort... (7 Replies)
Discussion started by: redse171
7 Replies

5. Shell Programming and Scripting

search for a pattern using grep

Hi I am facing the below problem. I have set of lines in which i have to search for only the line which matches with the pattren "/" only. input:- /*+ some text */ /*+ some text */ /* Remove rows from a table of survey results. */ /* Add a survey respondent's name and answers. */ /*... (7 Replies)
Discussion started by: manasa_vs
7 Replies

6. UNIX for Dummies Questions & Answers

Search specific pattern in file and return number of occurence

Hi I want to search for a specific pattern in file Say ABC;HELLO_UNIX_WORLD;PQR ABC;HELLO_UNIX_WORLD_IS_NOT_ENOUGH;XYZ ABC;HELLO_UNIX_FORUM;LMN Pattern to search is : "HELLO_UNIX_*****" and not "HELLO_UNIX_***_***_" I mean after "HELLO_UNIX" there can only be one word.In this case... (2 Replies)
Discussion started by: dashing201
2 Replies

7. UNIX for Dummies Questions & Answers

pattern search using grep in specific range of files

Hi, I am trying to do the following: grep -l <pattern> <files to be searched for> In <files to be searched for> , all files should of some specific date like "Apr 8" not all files in current directory. I just to search within files Apr 8 files so that it won't search in entire list of... (2 Replies)
Discussion started by: apjneeraj
2 Replies

8. Shell Programming and Scripting

extract specific line if the search pattern is found

Hi, I need to extract <APPNUMBER> tag alone, if the <college> haas IIT Chennai value. college tag value will have spaces embedded. Those spaces should not be suppresses. My Source file <Record><sno>1</sno><empid>E0001</empid><name>Rejsh suderam</name><college>IIT ... (3 Replies)
Discussion started by: Sekar1
3 Replies

9. UNIX for Dummies Questions & Answers

Search for very specific pattern with less

Hi, I want to search a certain pattern with less command in a files. For examples, I have a files with this entry: POLAR xx POLARX xc POLARXI x1 POLARZZZY vb POLARLLLLLLL ee... (1 Reply)
Discussion started by: anjas
1 Replies

10. Shell Programming and Scripting

how to grep a specific pattern

Hi I have a file in the following format: ftrn facc ttrd feed xref #1 1365 1366 1367 1097 1098 #2 1368 1369 1370 1095 1096 #3 1371 1372 1373 1065 1066 #4 1374 1375 1376 1099 1100 #5 1377 1378 1379 1080 1081 #6 ... (6 Replies)
Discussion started by: aoussenko
6 Replies
Login or Register to Ask a Question