Want to separate my /var/adm/messages output


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Want to separate my /var/adm/messages output
# 1  
Old 09-04-2011
Want to separate my /var/adm/messages output

Hi,

Please help to seprate my /var/adm/messages output. Than i want to take this
output in the excel.


e,g

cat /var/adm/messages

Sep 4 10:16:52 ibsadm1 inetd[461]: [ID 317013 daemon.notice] vnetd[7032] from 172.17.5.20 38353
Sep 4 10:16:52 ibsadm1 inetd[461]: [ID 317013 daemon.notice] bpcd[7033] from 172.17.5.20 915
Sep 4 10:16:55 ibsadm1 inetd[461]: [ID 317013 daemon.notice] bpcd[7034] from 172.17.5.20 537

so this will be save in some file like this

Date Time Hostname Error mesage
Sep 4 10:16:52 ibsadm1 inetd[461]: [ID 317013 daemon.notice] vnetd[7032] from 172.17.5.20 38353


Than i will copy this output in excel or if there is some process to deport this in excel, Please tell me

Thanks in advance

Regards
Nirjhar
# 2  
Old 09-04-2011
Try:
Code:
perl -lane 'print "$F[0] $F[1],$F[2],$F[3],@F[4..$#F]"' INPUTFILE >OUTPUT.csv

# 3  
Old 09-04-2011
Hi,

Thanks for the reply but i dont know much about Perl
If possible can you tell me the same in shell scripting.

Regards
Nirjhar
# 4  
Old 09-04-2011
There is not a "clean" shell programming/scripting. The shell programming is using and gluing command utilities and here perl is just a command utility like sed, tr, awk, etc...
You can make your csv file with sed or awk but those solutions just would be a little more complex.

Last edited by yazu; 09-04-2011 at 04:33 AM..
# 5  
Old 09-04-2011
Thanks for the reply

From the given code i am not able to see the columns heading
Date Time Hostname Error mesage

The rest i can do with the help of "awk" but i don 't know to get the heading so that my data will come under this.

Regards
Nirjhar
# 6  
Old 09-04-2011
Code:
(echo 'Date,Time,Hostname,Error Message'; awk '{...}' INPUTFILE) >OUTPUT.csv

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Difference between /var/log/syslog and /var/adm/messages

Hi, Is the contents in /var/log/syslog and /var/adm/messages are same?? Regards (3 Replies)
Discussion started by: vks47
3 Replies

2. Shell Programming and Scripting

trying get the last /var/adm/messages

grep \"^`date "+%b %d %T"`\" /var/adm/messages | egrep \"emerg|alert|crit|err|warning\ but get an output like this ksh: alert: not found ksh: crit: not found ksh: err: not found ksh: warning": not found grep: can't open "19" grep: can't open "16:27:16"" (1 Reply)
Discussion started by: arch12
1 Replies

3. UNIX for Advanced & Expert Users

/var/adm/messages vs /var/log/messages

The /var/adm/messages in Solaris seem to log more system messages/errors compared to /var/log/messages in Linux. I checked the log level in Linux and they seem OK. Is there any other log file that contains the messages or is it just that Linux doesn't log great many things? (2 Replies)
Discussion started by: gomes1333
2 Replies

4. Solaris

diff b/w /var/log/syslog and /var/adm/messages

hi sirs can u tell the difference between /var/log/syslogs and /var/adm/messages in my working place i am having two servers. in one servers messages file is empty and syslog file is going on increasing.. and in another servers message file is going on increasing but syslog file is... (2 Replies)
Discussion started by: tv.praveenkumar
2 Replies

5. UNIX for Advanced & Expert Users

separate "named daemon" message from /var/adm/messages

Hello group, How can I separate "named daemon" messages to the other file instead of /var/adm/messages. I still want all other daemons log the messages to /var/adm/messages. i.e. named => /var/adm/named.message other daemons => /var/adm/messages. I searched unix.com, and google but I still... (5 Replies)
Discussion started by: dannytrinh
5 Replies

6. Solaris

/var/adm/messages

Hello Friends, I am geting the folowing error in /var/adm/message is it disl related problem? if yes.. how to check all the disk are perfect or not? Sep 15 06:01:12 scsi: WARNING: /pci@1f,700000/scsi@2/sd@2,0 (sd7): Sep 15 06:01:12 Error for Command: write(10) Error Level:... (5 Replies)
Discussion started by: bullz26
5 Replies

7. UNIX for Dummies Questions & Answers

/var/adm/messages

Hi, No log entry is found in messages files. The file size is 0. We are using Solaris 9. Anyone knows what could be wrong. (3 Replies)
Discussion started by: FrankC
3 Replies

8. Solaris

/var/adm/messages

I'm running a Solaris 9 box with Oracle databases on it. I'm getting the following messages in my /var/adm/messages log "Jun 24 12:30:32 sundb01 bootpd: IP address not found: xxx.xxx.xxx.xxx" ...where xxx.xxx.xxx.xxx is DHCP IP addresses of Windows 2000 workstations in the organisation. ... (2 Replies)
Discussion started by: soliberus
2 Replies

9. Solaris

/var/adm/messages- Help

Solaris 8/ sun 420R Checked /var/adm/messages file and got the following message: Dec 4 16:40:05 serverXYZ ConfigProvider: get_pkg_instdate: getdate failed for the standard C locale (7) Does anyone know what this means? Looked up getdate but do not understand.... Thanks. (1 Reply)
Discussion started by: finster
1 Replies

10. UNIX for Dummies Questions & Answers

Messages in /var/adm

Just want to check with all of you out there what does the following warning means in my "messages" file in /var/adm the warning is Prevous Time Adjustment Incomplete , does it mean my hard ware is faulty if so which piece of hardware it is ? (1 Reply)
Discussion started by: owls
1 Replies
Login or Register to Ask a Question