Answers for "bash add or subtract one column from another"

1

bash add or subtract one column from another

# Basic syntax:
awk 'BEGIN {set_delimiter}; {print $column# +_or_- $column#}' input_file

# Example usage:
awk 'BEGIN {OFS="\t"}; {print $1 - $2}' input_file
# Set the delimiter to tab-delimited, print column 1 minus column 2

awk 'BEGIN {OFS="\t"}; {print $0, $1 + $2}' input_file
# Set the delimiter to tab-delimited, print all columns followed by
# column 1 plus column 2
Posted by: Guest on October-01-2020

Code answers related to "bash add or subtract one column from another"

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language