i did a script that retrieve content of a source file so i can create a target file the way i want it.
I do a "sed" command so i can change the word "Numérique" with "PIC S".
Source File .txt :
MotifRad;CHAR(2);Motif de radiation
MtPrime;Numérique 8.2;Montant prime d'origine
Target File .txt :
* Motif de radiation
05 MotifRad PIC X(2).
* Montant prime d'origine
05 MtPrime PIC S 8.2.
As you can see i did change the word "Numérique" but i'd like to add the number that follows in parentheses like that : PIC S (8.2), how could i do that ?
Bash script :
#!/bin/bash
#Fichier Source
fichier="APGFPOLI.des.txt"
champAdd="05 "
if [[ -f "$fichier" ]]
then
    
    # read it
    sed 1d $fichier| sed -i 's/CHAR/PIC X/' $fichier | sed -i 's/Numérique/PIC S/' $fichier | while IFS=';' read -r nomChamp format libelle
    do
        echo \* $libelle
        echo $champAdd $nomChamp $format.
    done <"$fichier" > test.txt
fi



05come from? And thisPIC X(2)? Please explain exactly what you are trying to achieve, do not expect us to guess from your attempts.