Friday, 31 May 2013

Print sum of all numbers in a file in linux using awk

This is to print the sum of all numbers in a file using awk.

If the file which we want to process is sum.txt, and it's content is :

How to join all lines in a file using comma as delimiter?

Sometimes we want to combine the lines in a file as single line. How to achieve this in linux using command line?

We can use the command 'paste' for this purpose.