On 2007-12-13 09:35, Halid Faith <[EMAIL PROTECTED]> wrote:
> Let me try to explain
> I have a file called A which contains variable values as below;
> file1, abc12
> foot1, cba11
> boby, def123
> ...
> 
> Also I have another file called B which contains partly valuable values as
> following;
> ### file of A begin
> Server valuable1
> Client valuable2
> #### the file end
> 
> I have to assign the first column valuables in A to valuable1 in B and
> assign second column valuable1 in A to valuable2 in B.
>
> Finally I should see as following in a file called C
> Server file1
> Client abc12
> 
> Server foot1
> Client cba11
> 
> Server boby
> Client def123
>
> How can I do that ? Could you give me a script ?

Look carefully at the second input file:

        Server valuable1
        Client valuable2

Now look *very* carefully at the output you want:

        Server file1
        Client abc12

        Server foot1
        Client cba11

        Server boby
        Client def123

Can you imagine a *loop* which reads the input file and creates the
second?  In `pseudo-code' this would be something like:

        for each pair of (server, client) from `file1':
                for each line in `file2':
                        substitute `server' and `client' in `line'
                        print resulting line
                print an empty line

That shouldn't be *too* hard to write in a shell script.  Now that you
have the outline, see if you have better luck.

- Giorgos

_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to