positioning words in a line

view story

http://www.unix.com – I have problem with this for last few days and I would really be grateful if you can help me :wall::wall::wall::wall::wall: I have sets of files in one directory, and each of them have few lines each one of these lines has 1 or more occurrence of words Y = [Dean James John Mark Bob] I need to find the position of the Y in each line and put them into a file with number of the words in the whole line and name them $Y-$name e.g. one file from directory --> file01.txt this is the house for James and Mark and Dean would like toJames want to test 2) Mark-file01.txt 16 I have tried to do bits as (HowTos)