bash find and remove text

Here's the story:
I have two txt files of filenames one is like this

W00CHZ0103340-I1CZ31
W00CHZ0103340-I1CZ32
W00CHZ0103340-I1CZ33
W00CHZ0103341-I1CZ35
W00CHZ0103342-I1CZ46
W00CHZ0103343-I1CZ37
W00CHZ0103344-I1CZ39
W00CHZ0103345-I1CZ43
W00CHZ0103345-I1CZ44
...
the other like this

W00CHZ0103340/images/W00CHZ0103340-I1CZ31/
W00CHZ0103340/images/W00CHZ0103340-I1CZ32/
W00CHZ0103340/images/W00CHZ0103340-I1CZ33/
W00CHZ0103341/images/W00CHZ0103341-I1CZ35/
W00CHZ0103342/images/W00CHZ0103342-I1CZ46/
W00CHZ0103343/images/W00CHZ0103343-I1CZ37/
W00CHZ0103344/images/W00CHZ0103344-I1CZ39/
W00CHZ0103345/images/W00CHZ0103345-I1CZ43/
W00CHZ0103345/images/W00CHZ0103345-I1CZ44/

I want to remove all the text up to and including images/ and then the final / then i would be left with identical lists. On list comes from an ls command and the other from some type of manifest that i am checking against. I need to do this so that i can then compare the two for unique entries and thereby find out what's missing. Please Help me

on the second file, run this:

#!/bin/bash
cat secondfile.txt | while read line
do
FN=`echo $line | awk -F\/ '{print $(NF-1)}' `
echo $FN
done

With sed:

sed 's!.*\(.*\)/!\1!' file2

or with awk:

awk -F/ '{print $3}' file2

Regards

now i have just one more question. I left work already where i need to try and use this script but it will drive me nuts all weekend if i don't get this thing licked. Will the above responses work even if the parameters following the W above change? for example sometimes the filenames change to W23704/images...etc It always starts with W but the proceeding characters can be a hadge podge of numbers and letters and not always the same number. Again, any help is really appreciated. I just want to know that i've got it come monday.

No problem. The sed command prints the piece between the last 2 slashes and the awk command changes the field seperator to a slash and prints the 3th field.

Regards

There's no need for cat, and calling awk for each and every line is ridiculously inefficient.

Adding to the inefficiency is storing the reault of each awk call in a variable with command substitution then printing the variable. Why not let awk's output be printed directly?

All it takes is a single call to awk, with the filename as an argument:

awk -F/ '{ print $(NF-1) }' secondfile.txt