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:
so they logged in from around 17:31 to around 17:36.
I am wondering if it would be possible to get just that. Get that information from the log and output it like that, John Smith logged in from 7:30 to 10:00 on Monday, August 30. If you would like to know how i'm logging it i could show that too, in case theres another way i could log it so its like that. also, i'm using bash on OS X.
if theres another post like this, please, direct me to it. I wasn't sure what to search for.
thanks, frans, thats exactly what I wanted. I'll just change the date format. thanks for the help.
---------- Post updated at 11:42 PM ---------- Previous update was at 05:34 PM ----------
well, sadly, the first few times it worked like a charm! and, i got it going with awk to show how many minutes they were logged in, too! but, for some odd reason, it still works and prints the results, but i get an error.
That's certainly due to a line (the last one?) in your log file that doesn't contain the '=' sign. So it reads A and B but B is empty. A turnaround : insert the bold command
ah thank you. now there is no error and it also removes duplicates. I was changing things yesterday and some of the lines are messed up, and the date didnt change for 5 entries, and before it showed all 5, but now it only shows 1. also, I did stop it from saying the error myself, by changing
to
As you can see the result with this little script, the result of [ $B-$C ] is always true.
The logic i involved ist that it should do something if second field is different from previous line and the result of previous script is
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)
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)
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)
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)
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)
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)
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)
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)