I am trying to print columns in file which are seperated by |
using awk.
File content:
postgres | psql | | 2018-09-17 05:00:45.096491+00 | | active
test_user | PostgreSQL JDBC Driver | ***.**.**.118 | 2018-09-17 03:55:22.310569+00 | | idle in transaction
test_user | PostgreSQL JDBC Driver | ***.**.**.95 | 2018-09-17 03:54:58.638521+00 | | idle in transaction
I am using below awk command to separate columns in file.
awk 'BEGIN { RS = "|" } ; { print $2 }' vv.txt
Also refer to image attached which gives clear idea about issue. I am not sure why data is getting messed up? Is it also considering space as separator?