Format output text using AWK (*nix)?

rock_ya_baby

~~~=o=~~~
Adept
I want to print an output in tabular format...

My commands are...
Code:
$ snmpget -v1 -c UUNNNXXX_UNI mib.1.1.1..1.2.2.2.0 172.16.1.2 | awk '{ print $4 }' | cat >> /tmp/output.txt&
The output of the first cmd segment is something like:

AAAAA BBBBB CCC FHK11223344

The fourth column is interesting data for me.
---------------

Now...

if the output is
Code:
AAAAA BBBBB CCC FHK11223344
AAAAA BBBBB CCC FHK55566600
AAAAA BBBBB CBG FHK43434342
AAAAC DSDSD CCW FHK2211111

I want to pair them up like this....

FHK11223344 FHK55566600
FHK43434342 FHK2211111

ie...

line1col4 line2col4
line3col4 line4col4
How to?
PS: I know cut,trim,tee,regex, awk and grep

I don't wanna use perl.
 
after printing the fourth column like you are doing with awk,

use sed with two regex:
i) to replace all end of lines with space
ii) replace the space after every second word with end of line
 
Back
Top