cat > temp001
5
10
12
6
9
12
5
cat > temp001 REF: https://www.unix.com/shell-programming-and-scripting/130727-how-subtract-adjacent-lines-single-column.html cat > temp001 REF: https://www.unix.com/shell-programming-and-scripting/130727-how-subtract-adjacent-lines-single-column.html
awk 'p{print
5
10
12
6
9
12
5
awk 'p{print $0-p}{p=$0}' temp001
5
2
-6
3
3
-7
-p}{p=
5
10
12
6
9
12
5
awk 'p{print $0-p}{p=$0}' temp001
5
2
-6
3
3
-7
}' temp001 awk 'p{print