Somme dans un fichier
Fermé
herysoa
Messages postés
9
Date d'inscription
lundi 28 juillet 2014
Statut
Membre
Dernière intervention
13 novembre 2014
-
13 nov. 2014 à 14:47
dubcek Messages postés 18767 Date d'inscription lundi 15 janvier 2007 Statut Contributeur Dernière intervention 5 mars 2025 - 14 nov. 2014 à 16:19
dubcek Messages postés 18767 Date d'inscription lundi 15 janvier 2007 Statut Contributeur Dernière intervention 5 mars 2025 - 14 nov. 2014 à 16:19
A voir également:
- Somme dans un fichier
- Fichier rar - Guide
- Comment réduire la taille d'un fichier - Guide
- Comment ouvrir un fichier epub ? - Guide
- Ouvrir un fichier .bin - Guide
- Formule somme excel colonne - Guide
4 réponses
dubcek
Messages postés
18767
Date d'inscription
lundi 15 janvier 2007
Statut
Contributeur
Dernière intervention
5 mars 2025
5 628
14 nov. 2014 à 08:20
14 nov. 2014 à 08:20
hello
$ cat fichier
1
10
100
1000
$ awk '{x+=$1} END {print x}' fichier
1111
Salut,
Juste pour le fun ;-))
Juste pour le fun ;-))
$ cat plop
1
10
100
1000
$ som=$(tr '\n' '+' < plop)
$ echo "${som%+}"
1+10+100+1000
$ echo "${som%+}" | bc
1111
dubcek
Messages postés
18767
Date d'inscription
lundi 15 janvier 2007
Statut
Contributeur
Dernière intervention
5 mars 2025
5 628
14 nov. 2014 à 10:29
14 nov. 2014 à 10:29
et aussi
$ sed '2,$s/$/+/;$s/$/p/' fichier | dc
1111
dubcek
Messages postés
18767
Date d'inscription
lundi 15 janvier 2007
Statut
Contributeur
Dernière intervention
5 mars 2025
5 628
14 nov. 2014 à 16:19
14 nov. 2014 à 16:19
et et aussi
$ echo $(($(sed '$!s/$/+/' fichier)))
1111