Help adding a key word search to my script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help adding a key word search to my script
# 8  
Old 10-23-2009
This works great. Thank you all so much for your help.

6) echo "enter your search criteria here"
read var_1;
cd /home/demo/current_release/logs/current
grep -i "$var_1" *.log|sort -u |more
;;
# 9  
Old 11-30-2009
Sorry, I have one more urgent request. My manager has asked me how to add a time variable. In other words, the user of the script must be able to choose a time, say 10-01-09 to 10-03-09. Can you please help me? He's asked for it by Close of business today. I'm thinking, why can I just use the line above,


6) echo "enter your search criteria here"
read var_1;
cd /home/demo/current_release/logs/current
grep -i "$var_1" *.log|sort -u |more
;;
MAYBE

7)echo "enter your time criteria here"
read var_2;
cd /home/demo/current_release/logs/current
grep -i "$var_1" *.log|grep -i "$var_2"|sort -u |more

Would that work do you think?

---------- Post updated at 12:45 PM ---------- Previous update was at 12:18 PM ----------

Last thing I'd like to mention is the date format of the log files are odd. It's like
demo-name.2009_320_123456.999.log The key thing here is 2009_320 where its year 2009 and the 320th day of the year. Any help would be greatly appreciated.

---------- Post updated at 03:14 PM ---------- Previous update was at 12:45 PM ----------

I got the date column to work, but now I've been asked to add the option to change the path? Anyone know how to do that in an option? Thanks.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Non-root script used search and list specific key words

Hy there all. Im new here. Olso new to terminal & bash, but it seams that for me it's much easyer to undarsatnd scripts than an actual programming language as c or anyother languare for that matter. S-o here is one og my home works s-o to speak. Write a shell script which: -only works as a... (1 Reply)
Discussion started by: Crisso2Face
1 Replies

2. Shell Programming and Scripting

How do i replace a word ending with "key" using awk excpet for one word?

echo {mbr_key,grp_key,dep_key,abc,xyz,aaa,ccc} | awk 'gsub(/^|abc,|$/,"") {print}' Required output {grp_key,xyz,aaa,ccc} (5 Replies)
Discussion started by: 100bees
5 Replies

3. Shell Programming and Scripting

Shell Script @ Find a key word and If the key word matches then replace next 7 lines only

Hi All, I have a XML file which is looks like as below. <<please see the attachment >> <?xml version="1.0" encoding="UTF-8"?> <esites> <esite> <name>XXX.com</name> <storeId>10001</storeId> <module> ... (4 Replies)
Discussion started by: Rajeev_hbk
4 Replies

4. Shell Programming and Scripting

Search for the word and exporting 35 characters after that word using shell script

I have a file input.txt which have loads of weird characters, html tags and useful materials. I want to display 35 characters after the word "description" excluding weird characters like $&lmp and without html tags in the new file output.txt. Help me. Thanx in advance. I have attached the input... (4 Replies)
Discussion started by: sachit adhikari
4 Replies

5. Shell Programming and Scripting

Search for the word and exporting 35 characters after that word using shell script?

I have a file input.txt which have loads of weird characters, html tags and useful materials. I want to display 35 characters after the word description excluding weird characters like $$#$#@$#@***$# and without html tags in the new file output.txt. Help me. Thanx in advance. My final goal is to... (11 Replies)
Discussion started by: sachit adhikari
11 Replies

6. Shell Programming and Scripting

Script for adding a word in front of all line in a file

Hi I've one file full of paths of certain files and I want to add some extra file words in front of all the paths. for eg: i have a file name test.txt which show some details only.. 024_hd/044/0344eng.txt 035_bv/222/editor.jpg here I want to add /usr/people/indiana/ infront of all the... (4 Replies)
Discussion started by: ratheeshp
4 Replies

7. 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

8. Shell Programming and Scripting

perl (word by word check if a hash key)

Hi, Now i work in a code that 1-get data stored in the database in the form of hash table with a key field which is the " Name" 2-in the same time i open a txt file and loop through it word by word 3- which i have a problem in is that : I need to loop word by word and check if it is a... (0 Replies)
Discussion started by: eng_shimaa
0 Replies

9. Shell Programming and Scripting

search for key word and execute

Hi, I am writing a shell (after 6-7 months)that has to receive text from another shell, check if the first line in the text has a key word and then execute different shell.I could come up with the below program structure, please suggest me if there is a better way to do it or please help me with... (14 Replies)
Discussion started by: rider29
14 Replies

10. Shell Programming and Scripting

Adding a word in front of a word of each line.

Adding a word in front of a word of each line.In that line only one word will be there. pl help:( (4 Replies)
Discussion started by: Ramesh Vellanki
4 Replies
Login or Register to Ask a Question