Home     Article Archive     Syndication     Contact Search

Marketplace

Cat 950f

Cat 950fShell script to find common words in the files?

Hello,
help everyone help me to find common words in the files. For example, if I have 3 files like:

file 1
12
54
65
67

file 2
23
54
65
66
76

file 3
12
23
34
54
66

and so on ...
These files have special charactersitics such as the words are integers and all are in ascending order.
what would be my production is:

1 file1, file2, file3
2 file1, file2
2 file1, file3
3 file2, file3

where the first column refers to the number of words game. I wrote a file to go on the control of 2 files, which is given below:

#! / Bin / sh
rm-f subst.txt
subst.txt touch
a = 1
while [$ a-le 296]
do
b = `expr $ a + 1"
while [$ b-295]
do
w $ cat a.txt | fgrep-w $ wf b.txt> tmp.txt
p = `wc-l awk tmp.txt | '(print $ 1)`
echo $ p
if (($ p! = 0))
then
echo $ p "p" $ a "w" $ b ",">> subst.txt
else
echo "null"
fi
b = `expr $ b + 1"
fact
a = `expr $ a + 1"
fact

but it would be a stupid idea to extend it with more while loops in the statement condtional, and break when a match is not found.

Can I get a bright idea that? Frankly, I'm not really in shell scripts!

Thank you in advance.

Here's a site that might help you:

http://www.davidpashley.com/articles/wri ...

Posted on May 28, 2010.
Share |

Comments

There are no comments.

Leave a Comment

Your Name
Your Email
Comments
Human Check. Type 3552.

Popular Posts
Pet Snakes
Double Decker Rabbit Hutch
Irish Horses
Id Pet Food
Fluval Duo 800
Rabbit Pet Shop
Arctic Cat Snowmobile Manuals
Mosaic Birdbath

Blogroll
Gamed Owner
Toy Parlour
Game Fringe
Bath Divine
Home Tactic
Home Combat
Sunbeam Home
Home Soak
Crickets Kitchen
Mission Yard
Curt Yard
Safety Freaks