Hi Guys,
I'm new to awk and trying to format an stadout "temp.txt" to csv format so I can export to excel. I'm having issues here is my code so far..If any one can help to see the light!!! The ### sign is the second server on the list each server has that information before the ## sign...
Thank you for your help!!!
code:
awk 'NR==1 { print $1, $3, $5, $7, $9, $11, $13} { print $2, $4, $6, $8, $10, $12 }' RS='\n\n' FS=': +|\n' OFS='\t' temp.txt
output: Here my output so far with titles. Please see the temp.txt for the raw data. Also after the #### is another server on the list
Name System ID Locked Registered Last Checkin OSA Status
webdev.domain.com 1000000002 False 20121002T16:53:52 20140405T16:30:01 offline
webdev.domain.com 192.168.1.11 2.6.9-89.ELhugemem
---------------
----------------- |-- rhn-tools-rhel-4-as-i386
---------------------- LDAP_Basics_4 crontab_scripts SudoPrivs24
------------ monitoring_entitled
------------- Development Test Group Database
Here is my temp.text file:
Name: webdev.domain.com
System ID: 1000000002
Locked: False
Registered: 20121002T16:53:52
Last Checkin: 20140405T16:30:01
OSA Status: offline
Hostname: webdev.domain.com
IP Address: 192.168.1.11
Kernel: 2.6.9-89.ELhugemem
Activation Keys
---------------
61-a10823ed52fbd5f9f69fcb7f744fd0f4
Software Channels
-----------------
rhel-i386-as-4
|-- rhn-tools-rhel-4-as-i386
Configuration Channels
----------------------
TSMCheckScriptRH4
LDAP_Basics_4
nag_libexec_scripts
crontab_scripts
syslog_4
SudoPrivs24
universal
Entitlements
------------
enterprise_entitled
monitoring_entitled
provisioning_entitled
System Groups
-------------
Environment: Development
Red Hat 4
Test Group
Type: Database
##############################
Name: test.qa.domain.com