Organizing log


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Organizing log
# 1  
Old 02-21-2011
Organizing log

Hello,

Following are the log of my sms application

COMMAND:
Code:
#tail -30 /var/log/smsd.log | grep Message_id | awk '{print $1,$2,$9}'

OUTPUT:
Code:
2011-02-21 12:16:20,5, 03218975857,
2011-02-21 12:16:26,5, 03323048252,
2011-02-21 12:16:53,5, 03323048252,
2011-02-21 12:16:59,5, 03218975857,
2011-02-21 13:42:52,5, 03212911018,

Now i want to display the above mention output like as:
Code:
2011-02-21 12:16:20 03218975857
2011-02-21 12:16:26 03323048252
2011-02-21 12:16:53 03323048252
2011-02-21 12:16:59 03218975857
2011-02-21 13:42:52 03212911018

Moderator's Comments:
Mod Comment Please use [code] and [/code] tags when posting code, data or logs etc. to preserve formatting and enhance readability, thanks.

Last edited by zaxxon; 02-21-2011 at 08:00 AM.. Reason: code tags
# 2  
Old 02-21-2011
Code:
tail -30 /var/log/smsd.log | awk -F, '/Message_id/ {print $1$3}'

Moving thread to the shell script area.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Please help me in organizing the data in UNIX

I have an output file in the form Hostname Value1=abc Value2=def Value3=xyz Hostname1 Value1=abc1 Value2=def1 Value3=xyz1 Hostname2 Value1=abc2 Value2=def2 Value3=xyz2 | | | And so on….. I need to export this output into csv so then it should be in format (8 Replies)
Discussion started by: rahul2662
8 Replies

2. Shell Programming and Scripting

Organizing text file by Capital Names (capital word ' ' capital word)

Hi I have a file passwd_exmpl that contains: root:x:0:0:root:/root:/bin/bash bin:x:1:1:bin:/bin:/sbin/nologin daemon:x:2:2:daemon:/sbin:/sbin/nologin adm:x:3:4:adm:/var/adm:/sbin/nologin lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin sync:x:5:0:sync:/sbin:/bin/sync... (5 Replies)
Discussion started by: eladage
5 Replies

3. HP-UX

Script to monitor /var/opt/resmon/log/event.log file

AM in need of some plugin/script that can monitor HP-UX file "/var/opt/resmon/log/event.log" . Have written a scrip in sh shell that is working fine for syslog.log and mail.log as having standard format, have interrogated that to Nagios and is working as I required . But same script failed to... (3 Replies)
Discussion started by: Shirishlnx
3 Replies

4. Shell Programming and Scripting

help with organizing some non regular text

hey im trying to get the hex diffrences in two files ones called new and the other is named old i want it to phrase into my script, heres how i need the info: input='\x'94 #the new 1 byte hex change offset=00000000 #the 1st offset of the difference patch unset input offset input='\x'34... (5 Replies)
Discussion started by: lewisdenny
5 Replies

5. Programming

Organizing C++ Code

I have three directories CspInterp, FpnInterp and LinInterp. Each directory contains 4 .h and .ccp files describing 4 classes each CspInterp class CspFsInterp1d : public FsInterp1d class CspVsInterp1d : public VsInterp1d class CspFsInterp2d : public FsInterp2d class CspVsInterp2d : public... (10 Replies)
Discussion started by: kristinu
10 Replies

6. Shell Programming and Scripting

How can view log messages between two time frame from /var/log/message or any type of log files

How can view log messages between two time frame from /var/log/message or any type of log files. when logfiles are very big and especially many messages with in few minutes, I would like to display log messages between 5 minute interval. Could you pls give me the command? (1 Reply)
Discussion started by: johnveslin
1 Replies

7. Shell Programming and Scripting

Organizing Files

Hi, I'm fairly new at scripting. I need to write a script that takes files from a source directory puts them in a target directory and sorts them by artist name. This is what I have so far #!/bin/bash source_dir='/home/tcindy/songs' target_dir='/home/tcindy/music' for path in... (2 Replies)
Discussion started by: tcindy
2 Replies

8. Shell Programming and Scripting

Organizing a log

I have a bunch of log files generated from a shell script, its all of my facebook friends and if theyre logged in. Each file is a different person. It runs every 5 minutes. The log file is just the date and time, then 1 if theyre logged in or 0 if theyre not. part of one of the files is: Mon Aug... (5 Replies)
Discussion started by: killer54291
5 Replies

9. Shell Programming and Scripting

Help organizing a music directory with sub directories.

Hello all, I used to have a great script and I lost it :( What the script did was searched a directory named say "music" It searched all sub directories for .mp3 files Then placeed all the .mp3's into a directory of the band name It also renamed the .mps "track#, band name, album name" (I... (9 Replies)
Discussion started by: komputersman
9 Replies
Login or Register to Ask a Question