RE: loop with awk

"MOKRANI Rachid [email protected] [sed-users]" <[email protected]> Fri, 2 Jun 2017 07:44:36 +0000
Newsgroups gmane.editors.sed.user
Message-ID <[email protected]>
Thanks,

But I need to add the awk cmd in the loop.

In my exemple, I need to do a loop in a file  and add the result of the loop for each line at the end of each line  of the file A.txt. (I hope I’m clear…)

Regards.



De : Jim Hill [mailto:[email protected]]
Envoyé : jeudi 1 juin 2017 18:30
À : MOKRANI Rachid
Cc : sed-users
Objet : Re: loop with awk

    sed -E 's/([^;]*);([^;]*);([^;]*);.*/&;\L\2+\3/' fileA.txt

    awk '{print $0,tolower($2"+"$3)}' FS=\; OFS=\; fileA.txt





De : MOKRANI Rachid
Envoyé : jeudi 1 juin 2017 18:08
À : '[email protected]'
Objet : loop with awk

Hi,

I think it’s very simple, but I don’t find how to do it.

cat A.txt :

Mme;Sylvie;Blue;Paris;FR
Mr;Dan;Green;New-York;USA
Mr;David;Allen;Cannes;France

#!/bin/bash
for f in $(cat A.txt | awk -F ";" '{print $2"+"$3}')  ;
do
echo "$f" | tr '[:upper:]' '[:lower:]'
done

OK, the result is :
sylvie+blue
dan+green
david+allen


But I want to add the result at the end of the each line of the file A.txt

Need result in a new file B.txt :

Mme;Sylvie;Blue;Paris;FR;sylvie+blue
Mr;Dan;Green;New-York;USA;dan+green
Mr;David;Allen;Cannes;France;david+allen

Regards.




__________________________
Avant d'imprimer, pensez à l'environnement ! Please consider the environment before printing ! 
Ce message et toutes ses pièces jointes sont confidentiels et établis à l'intention exclusive de ses destinataires. Toute utilisation non conforme à sa destination, toute diffusion ou toute publication, totale ou partielle, est interdite, sauf autorisation expresse. IFP Energies nouvelles décline toute responsabilité au titre de ce message. This message and any attachments are confidential and intended solely for the addressees. Any unauthorised use or dissemination is prohibited. IFP Energies nouvelles should not be liable for this message.
__________________________


[Non-text portions of this message have been removed]