fork(1) download
  1. #!/bin/bash
  2. s="a82411:x:1015:1006:Adriana Morais,,,:/home/a82411:/bin/bash
  3. a60395:x:1016:1006:Afonso Pichel,,,:/home/a60395:/bin/bash
  4. a82420:x:1017:1006:Afonso Alves,,,:/home/a82420:/bin/bash
  5. a69225:x:1018:1006:Afonso Alves,,,:/home/a69225:/bin/bash
  6. a82824:x:1019:1006:Afonso Carreira,,,:/home/a82824:/bin/bash
  7. a83112:x:1020:1006:Aladje Sanha,,,:/home/a83112:/bin/bash
  8. a82652:x:1022:1006:Alexandre Ferreira,,,:/home/a82652:/bin/bash
  9. a83063:x:1023:1006:Alexandre Feijo,,,:/home/a83063:/bin/bash
  10. a82540:x:1024:1006:Ana Santana,,,:/home/a82540:/bin/bash"
  11.  
  12. awk 'BEGIN {FS=OFS=":"} {sub(/^a/, "", $1); gsub(/,/, "", $5); print $1, $5, _, _ "a" $1 "@"}' <<< "$s"
Success #stdin #stdout 0s 23336KB
stdin
Standard input is empty
stdout
82411:Adriana Morais::a82411@
60395:Afonso Pichel::a60395@
82420:Afonso Alves::a82420@
69225:Afonso Alves::a69225@
82824:Afonso Carreira::a82824@
83112:Aladje Sanha::a83112@
82652:Alexandre Ferreira::a82652@
83063:Alexandre Feijo::a83063@
82540:Ana Santana::a82540@