I used awk to generate the following output
root | /root
bin | /bin
daemon | /sbin
adm | /var/adm
lp | /var/spool/lpd
My awk query is as follows
head -n 5 /etc/passwd | awk ' BEGIN{ FS=":";OFS=" | "; } { print $1 , $6 } '
I want the output to be displayed in a formatted manner as below
root | /root
bin | /bin
daemon | /sbin
adm | /var/adm
lp | /var/spool/lpd
Is it possible to achieve this using awk . Also , the code should work on multiple input fields delimited by |