You can use awk:
awk '{ sum += $1 } END { print sum }' file
More Related Contents:
- sh: 1: Syntax error: "(" unexpected error
- Fastest way to find lines of a file from another larger file in Bash
- How can I delete a newline if it is the last character in a file?
- Insert multiple lines into a file after specified pattern using shell script
- How can I trim white space from a variable in awk?
- Iterate over a list of files with spaces
- ./configure : /bin/sh^M : bad interpreter [duplicate]
- Defining a variable with or without export
- The ‘eval’ command in Bash and its typical uses
- Better way to rename files based on multiple patterns
- How to join multiple lines of file names into one with custom delimiter?
- Convert date formats in bash
- Syntax error in shell script with process substitution
- Linux: copy and create destination dir if it does not exist
- Get program execution time in the shell
- How to handle more than 10 parameters in shell
- Linux bash: Multiple variable assignment
- How to sort a file in-place?
- Is it OK to use the same input file as output of a piped command?
- Finding contents of one file in another file
- Changing default shell in Linux [closed]
- Example of using named pipes in Linux shell (Bash)
- Passing variables in remote ssh command
- When to wrap quotes around a shell variable?
- How to get file creation date/time in Bash/Debian?
- Execute command after every command in bash
- How do I change bash history completion to complete what’s already on the line?
- Running shell script in parallel
- What’s the point of eval/bash -c as opposed to just evaluating a variable?
- How to convert hex to ASCII characters in the Linux shell?