[lug] awk help

Kevin Fenzi kevin at scrye.com
Mon Jan 24 10:45:38 MST 2000


>>>>> "William" == "William Jarosko Jr " <winrip at fpcc.net> writes:

William> Well after using awk for the first time last night I have a
William> question, well I have several but this one I'm having trouble
William> finding an answer to. I'm using this command;

William>   awk '/log/ {print $10 $12}' /var/log/secure

William>  Now here's my question, how can I place a space in the
William>  output from
William> field 10 to field 12. The command works as it should however,
William> the username and machine name are lumped together. I'd like
William> to make the output a little more readable using a space or
William> even a tab.

sure, just add a " " in there...

awk '/log/ {print $10 " " $12}' /var/log/secure

should do the trick. You can add a tab in with a "\t"

William> Thanks in advance.  Bill.

kevin
-- 
Kevin Fenzi
MTS, tummy.com, ltd.
http://www.tummy.com/  KRUD - Kevin's Red Hat Uber Distribution




More information about the LUG mailing list