1

Comparing lines of data

view story
linux-howto

http://www.unix.com – Total UNIX Rookie, but I'm learning. I have columns of integer data separated by spaces, and I'm using a Mac terminal. What I want to do: 1. Compare "line 1 column 2" (x) to "line 2 column 2" (y); is y-x>=100? 2. If yes, display difference and y's line number 3. If no, increment x and y by one and repeat How I am going about it: Code: sed -n '1,2 p' datafile | cut -d' ' -f1 #gives me the two fields of interest Where do I go from here? (HowTos)