05-11-2009
Hi izuma,
The code you hav posted working fine for me .
is it what your expecting ?...
ex :
TEST>cat cg.txt
Rama
seetha
TEST>cat tmp2.txt
Rama seetha dadfdf dgg
fdgdfg
no mtch
Rama dsd lalal
TEST>cat script.sh
for i in `cat cg.txt`
do
z=`grep $i tmp2* | wc -l`
echo "for the string : $i -> $z "
done
TEST>./script.sh
for the string : Rama -> 2
for the string : seetha -> 1
Last edited by panyam; 05-11-2009 at 07:04 AM..
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi all,
I would want to recieve notification only if there are sessions block in our databases.
This is my script, but it's not working. No matter what is the contents in the $OUTFILE, I get emails.
/usr/bin/cat $OUTFILE | read selected
if
then
echo "No session is blocked"
else
... (7 Replies)
Discussion started by: *Jess*
7 Replies
2. Shell Programming and Scripting
hi everyone,
1.txt
12
34
56
2.txt
456----aa
abc;b;b;b
34;a;a;a;a
output is
456----aa
34;a;a;a;a (11 Replies)
Discussion started by: jimmy_y
11 Replies
3. Shell Programming and Scripting
I have a textfile containing text similar to the following pattern:
STRING1
UNIQUE_STRING1
STRING2
STRING3
STRING4
STRING5
STRING1
UNIQUE_STRING2
STRING2
STRING3
STRING4
STRING5
STRING1
UNIQUE_STRING3
STRING2
STRING3 (6 Replies)
Discussion started by: ilcsfe
6 Replies
4. Shell Programming and Scripting
Hi,
1_strings file contains
$ cat 1_strings
/home/$USER/Src
/home/Valid
/home/Review$ cat myxml
<projected value="some string" path="/home/$USER/Src">
<input 1/>
<estimate value/>
<somestring/>
</projected>
<few more lines >
<projected value="some string" path="/home/$USER/check">... (4 Replies)
Discussion started by: greet_sed
4 Replies
5. Shell Programming and Scripting
Hi ,
i'm trying to create a code for the belwo scenario.
i have a data in a file file.txt like below.
ram
dept
comp
shyam
field
comp
Now i need write a code to find the string which is always 2 lines before the string "comp"
Can you please help me in this.
Thanks in advance (15 Replies)
Discussion started by: p.bhaskar
15 Replies
6. Shell Programming and Scripting
I am attempting to grep an exact string from a series of files within a directory and append that output to the filename when it is present in the file. I've been after this all day with no luck. Thanks for your help in advance :wall:. (4 Replies)
Discussion started by: JC_1
4 Replies
7. Shell Programming and Scripting
logfile="/var/tmp.log"
output=$(grep "ERROR" $logfile)
if
then
echo "exceptions logged , please check /var/tmp.log for more details" |\
mail -s "exceptions logged , please check /var/tmp.log on for more details" $DL
else
echo "not found"
fi
Somehow its not working as... (5 Replies)
Discussion started by: ajothi
5 Replies
8. Shell Programming and Scripting
Hi,
I have a list of zipped files. I want to grep for a string in all files and get a list of file names that contain the string. But without unzipping them before that, more like using something like gzcat.
My OS is:
SunOS test 5.10 Generic_142900-13 sun4u sparc SUNW,SPARC-Enterprise (8 Replies)
Discussion started by: apenkov
8 Replies
9. Linux
Hi,
Anyone can help, I have a large textfile (one file), and I need to split into multiple file to break each file into ^L.
My textfile
==========
abc company
abc address
abc contact
^L
my company
my address
my contact
my skills
^L
your company
your address
========== (3 Replies)
Discussion started by: fspalero
3 Replies
10. Shell Programming and Scripting
I have a file comp.pkglist which mention package version and release . In 'version change' and 'release change' line there are two versions 'old' and 'new' Version Change: --> Release Change: -->
cat comp.pkglist
Package list: nss-util-devel-3.28.4-1.el6_9.x86_64
Version Change: 3.28.4 -->... (1 Reply)
Discussion started by: Paras Pandey
1 Replies