Playing with awk

smbstatus -S 2>/dev/null|awk ‘BEGIN{FS=" ";OFS=" ";}{$2=""; print $0;}’|awk ‘{print $1,"         ",$2,"         ",$3,$4,$5,$6,$7}’

–> Above command will hide column 2 and will give you below output:

Service           machine           Connected
——————————————————-        

For hiding above lines … to just get only service name – mahine name – connected… –>

smbstatus -S 2>/dev/null|awk ‘BEGIN{FS=" ";OFS="   ";}{$2=""; print $0;}’|awk ‘{print $1,"         ",$2,"         ",$3,$4,$5,$6,$7}’|grep -v ^Ser

Neelesh Gurjar has written 122 articles

Leave a Reply