try
... | awk '$1 == "1" {print $2 ; l=NR+1 ; } NR == l { print $1 ;}'
where
$1 == "1"select line where first field is 1{print $2print it's valuel=NR+1 ; }remember next lineNR == lselect second line{ print $1 ;}print first field
remember awk doesn't think in term of column, just field.
thoses two lines are equivalent using $1 $2
hello world
hello world
Assigning to var
... | awk '$1 == "1" {printf "A=%s\n" ,$2 ; l=NR+1 ; } NR == l { printf "B=%s\n" ,$1 ;}' > /tmp/.var
. /tmp/.var
last line is a dot (.) a space ( ) and /tmp/.var
- printf in awk need a comma after argument.