Execution problems with grep command in scripting


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Execution problems with grep command in scripting
# 1  
Old 04-11-2011
Execution problems with grep command in scripting

Hi All,
I was looking for grep command option which can exactly matches the word in a file, for examples you may be seeing one word that is also in another word, there might be lkk0lv23 and a lkk0lv234 in which case lkk0lv23 will put BOTH hosts from the grep in.

I was using this in a bash script to grep multiple entries in a file and this causing me a duplicate copies in final output file, how to eliminate it, is their a similar command that I can use.





Code:
 grep -i "$line" "$CFILE"; sleep 1 >> "$OFILE"

# 2  
Old 04-11-2011
grep -w "lkk0lv23" file
This User Gave Thanks to pbillast For This Post:
# 3  
Old 04-11-2011
It worked, Thanks
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Dsh command : Execution Problems with Cron

Hi, On linux cluster, i created a script to delete all temp files older than 5 days. i am able to execute the script "dsh -ea script.ksh" in management node directly But when i schedule "dsh -ea script.ksh" in crontab in management node it tells dsh command not found. How to solve... (2 Replies)
Discussion started by: smartrajusid
2 Replies

2. Shell Programming and Scripting

Execution problems with scripting

Hi, I am new to scripting.I had one problem infront of me.I tried in many ways with minimal knowledge........Kindly help me. Description: I want a shell script where it has to read an input.txt file and need to remove duplicate lines and the result need to kept in output.txt file. input... (5 Replies)
Discussion started by: bhas
5 Replies

3. Shell Programming and Scripting

Execution Problems

this my source file ************* fixed *************** Begin equipmentId : d9 processor : fox number : bhhhhhh Variable # 1: Id : 100 Type : 9 nType : s gType : 5f mType : 4 LField : England DataField : london Length ... (6 Replies)
Discussion started by: teefa
6 Replies

4. Linux

ssh and passwd scripting execution problems on linux

I'm having a problem here and I was wondering if anyone could help me? I'm putting together a password script. First off, I don't have root access. I have sudo access. Lets say the User ID is Trevor1, the password is H!rry23! and the server name is Linux1234 This is how the script begins ... (5 Replies)
Discussion started by: wdog17
5 Replies

5. Shell Programming and Scripting

Execution Problems!!

i have been working on this for a about 12 hours today say's end of file un expected any idea's using the bourne shell and its driving me nuts worked fine in bash but prof says make it work in bourne and good luck worth 13% any help would be awesome #!/bin/sh trap "rm mnt2/source/tmp/* 2>... (1 Reply)
Discussion started by: mrhiab
1 Replies

6. Shell Programming and Scripting

Execution problems with the jar -tvf command and "if" logic

Hi, I am reading a directory that has a list of jar files. I am searching these files for specific keywords. What i would like to do is write the address of the jar file to a new file if the search result is returned as false. For example; /home/user/JarDirectory/Examplefile.jar ... (2 Replies)
Discussion started by: crunchie
2 Replies

7. UNIX for Dummies Questions & Answers

Command execution in grep

I'm taking Unix Scripting course and we've been given the following command grep -l "`echo '\t'`" foo What this command is basically doing is giving the lines in the ordinary file foo that contains the letter 't'. From my understanding, command substation occurs first. So echo '\t' is... (2 Replies)
Discussion started by: kkhan00
2 Replies

8. Shell Programming and Scripting

Execution problems with comm command

I tried to compare two sorted files with comm command which contain floating values as: RECT 0 9.8 8.70 7.8 in first file & RECT 0 9.80 8.7 7.80 in second file. comm -3 first_file second_file should give a empty file but it does not. Is there a way to compare these two files correctly... (4 Replies)
Discussion started by: nehashine
4 Replies

9. Shell Programming and Scripting

Execution problems using awk command.

Hi All, I have the following requirement. In a directory i get files from external source. I at regular intervals check that directory for any incoming files. The file name is underscore delimited. Such as: aaa_bbb_ccc_ddd_eee_fff.dat I am using awk and and splitting the file name. ... (4 Replies)
Discussion started by: satishpv_2002
4 Replies

10. Shell Programming and Scripting

command substitution problems with csh using grep

I am trying to set a command into a variable in a csh script using command substituion with ``. I am having a problem with ps command combined with grep. The command is as follows (shows processes running with the word gpts in them). /usr/ucb/ps axwww | grep gpts this works fine at the... (2 Replies)
Discussion started by: voodoo31
2 Replies
Login or Register to Ask a Question