Lets say we have a simple file data.txt
which has the following content:
1
2
3
Is there a command to perform arithmetic on every row value of the file via piping? I'm looking for something like cat data.txt | arit "+10"
which would output:
11
12
13
The best thing I know is performing arithmetic by using bc
for individual values, for example echo "1+10" | bc
, but I wasn't able to apply this to my own example which contains many values with trailing newlines.