awk array
Code:
grep 'detail' filename.log | awk '{variable[$1]=$1" "$6; for (index in variable) {print variable[index]}}' How can I make it to store one line, and print one line at a time? |
At the point of calling the for loop the array will be growing so on the first pass it will write the first value and then when the next line is read it will write
the first again and the second. Is this what you wanted? Does the value of $1 constantly change? If not it will overwrite the previous value each time a new line is read. |
Quote:
Quote:
|
Perhaps
Code:
grep -e 'detail' filename.log | awk '{ variable[$1] = $1 " " $6 } END { for (i in variable) print variable[i] }' |
All times are GMT -5. The time now is 06:41 AM. |