Bash Cookbook

less than 1 minute read

Bash Cookbook

In this article I will post a cookbook like set of bash commands that I needed to use for several different scenario. In addition there would be information regarding common things to look out for while bash scripting or pitfalls.

  1. Find difference in two consecutive numbers from a file or a bash output. I used it to calculate time difference between consecutive timestamps: awk 'NR>1{print $1-p} {p=$1}' file

  2. Without quotes shell doesn’t apply any expansion rules and treats new lines as space

References