Link to home
Start Free TrialLog in
Avatar of Kent Dyer
Kent DyerFlag for United States of America

asked on

SED and AWK (gawk) field delimiters

Note: This code does work fine..  However, I am getting a tab (Chr(9)) between the fields and would like to get Chr(44) or a comma.. Is that possible under this construct or do I need to  re-format the file once generated?

sed -n "s/ns1://g;s/:ns1//g;/signin xmlns/,/signin/p;/\<signin.*/,/<\/signin>/{/\<orgName>/s/\<orgName><*/orgName>/};{/\<userName>/s/\<userName>[^m][^o][^n][^i][^t][^o][^r][^A][^c][^c][^t][^<]*/userName>/};{s/\<orgName>/<\/orgName>/}" "Apache_log" | gawk "/orgName/" { print substr($1,10,length($1)-19) }"|sort|uniq -c

Open in new window


Would also like to re-arrange the fields to be:
ORG,Time,Count

Currently, the raw logs are:
Count,ORG,Date,Time


Thanks,

Kent
ASKER CERTIFIED SOLUTION
Avatar of wesly_chen
wesly_chen
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial