Probleme avec awk -F

Bonjour,

je voudrais avoir la premiere colonne de mon fichier fic1, voilà le contenu

052537779 |684443 | 102000 |14-FEB-10 10.29.06.241944 AM
004976269 |694711 | 251000|14-FEB-10 05.20.19.968168 PM
004976270 |294711 | 250300|14-FEB-10 05.21.52.599103 PM
004976274 |382324 | 250040|14-FEB-10 08.18.42.857193 PM

J'ai fais :
awk 'BEGIN {FS=' | '} {print $1}' detail_voucher_20110215.lst | head

Pourriez-vous me guider?

Best regards/

3 réponses

  1. Contributeur
    hello
    essayer avec
    awk 'BEGIN {FS="|"} {print $1}' detail_voucher_20110215.lst | head 
    1. Contributeur
      Salut,

      'BEGIN {FS=' | '}
      Il y a un espace en trop après le pipe ;-(

      'BEGIN {FS=' |'}

      Devrait mieux le faire ;-))