Problem in extracting vector data

Hi,

Currently I have two files; A and B.

File A has below data:-

-3 + <1 2 3 4 5 6 7 8 1 2 > - 1]
-2 + <8 8 3 4 0 3 7 9 1 3 > - 1]
-1 + <3 7 3 4 8 2 7 2 1 2 > - 1]
-3 + <2 2 3 4 3 1 7 8 8 2 > - 1]

and File B has below data:-
<9 1 1 4 2 6 3 8 8 9 >

From these two files, I try to do a cross product vector for these two files.
<1 2 3 4 5 6 7 8 1 2 >*<9 1 1 4 2 6 3 8 8 9 >
+<8 8 3 4 0 3 7 9 1 3 > *<9 1 1 4 2 6 3 8 8 9 >
+<3 7 3 4 8 2 7 2 1 2 > *<9 1 1 4 2 6 3 8 8 9 >
+<2 2 3 4 3 1 7 8 8 2 > *<9 1 1 4 2 6 3 8 8 9 >

Could anyone show me how I could extract the elements from these two files such as above?

As of now I could cat the file A but do not know how to extract elements from < on wards. And i do not know how I could perform division with elements form another file, file B.

Please help. Thanks alot.

Please add some more hints. Is file B always a single line? Do you want to do this in the Enterprise Silver Platinum Mojo Beans way or just a one-off job?

sed -e 's/.*/s%^.*\\(<[^<>]*>\\).*%\\1 \* &%/' fileB | sed -f - fileA

In the famous words of Dennis M. Ritchie, You Are Not Supposed to Understand This.

Actually, as a brief overview, we are taking the contents of fileB (presumably a single line) and wrapping it inside some sed commands, which are then passed as a script to sed to run on fileA. Conveniently, the first sed writes a script for the second containing the contents of fileB and a bit of sed trickery. It's not even tricky at all, once you wrap your head around it (and decode the escapes needed to prevent the literal parts in the first script from being interpreted by the first sed).

assume that there is only a single line in fileB!
using awk :

awk 'NR == FNR {var=$0}
       NR != FNR { 
         if(FNR > 1)    $3 = "+"$3;
         print $3 "*" var
       }'  FS="(+)|(-)"  fileB fileA