itik
1
Hi All,
I want to execute this
cat /etc/passwd | awk -F: '{print $1,$7}'
with a fixed column on the first and second. Say on the first I want 12 column and second with 20 column.
Example
root /usr/bin/ksh
lp /bin/false
Thanks for any comment you may add.
no need of cat awk can read file directly
what do you mean column on first and second?
awk -F: '{print $1,$NF}' /etc/passwd
You may want to try the printf statement to produce fixed width columns. It is similar to the C and Perl language printf syntax.
awk -F: '{printf("%12s %20s\n", $1,$7)}' /etc/passwd
itik
6
THANKS!
This is what i want
awk -F: '{printf("%12s %20s\n", $1,$7)}' /etc/passwd