How can I direct messages from mac console.app to a log file?
I'm trying to complete a bash script to capture if an external webcam is active in a video conference session. Some users will switch the camera to the built-in MAC camera. When this happens I want to trigger a set of events.
Things tried: reviewed the console.app to look for patterns on when the switch occurs in a user test & discovered messages indicating when the facetime camera changes state. I found this
I thought I could simply grep these message from the console.app but it seems to be easier said than done. I thought i could find the msgs in one of the console report files but When I look at the various reports on the console, i'm not finding a report that contains the messages above. How can I direct messages from console.app to a log file versus manually copying and pasting the info from the console?or point me to a direction? Am I missing something?
Hi All,
I have an expression as follows:-
a=`expr ${i} + ${j}` >> $log_file 2>&1
Here, if any of the values i or j or both happens to be empty then the "expr" returns error as
"expr: 0402-050 Syntax error." My problem is I am not able to re-direct this error to the log file. Its is getting... (4 Replies)
Hi,
I have a script to compare 2 files.
file1=$1
file2=$2
num_of_records_file1=`awk ' END { print NR } ' $file1`
num_of_records_file2=`awk ' END { print NR } ' $file2`
i=1
while
do
sed -n "$i"p $file1 > file1_temp
sed -n "$i"p $file2 > file2_temp
diff file1_temp... (5 Replies)
Hi there,
We have 2 apps on our customers machines that can both open files with the same file extension. Is there any way via shell commands to set which application should be the default?
Essentially, I'm hoping to replicate Get Info > Open With > Change All using a shell script, but I just... (0 Replies)
Hello, currently we are executing a .sh from terminal.
The current .sh looks like this:
#!/usr/bin/env bash
/Users/user/my.app/Contents/MacOS/my &
--
Now, we also need to run a third line in the .sh - It's a command line application that I need to run when I execute the above .sh... (0 Replies)
#!/bin/ksh -x
cd /tmp/tj
ftp -n servername.com << DONE
user username password
as
put test.log
quit
close
DONE
echo "testing..."
sh -x scriptname, and it shows all, but username, as, put, quit, close, DONE.
how can i see those ? (1 Reply)
Hi guys,
been scratching round the forums and my mountain of resources.
Maybe I havn't read deep enough
My question is not how sed edits a stream and outputs it to a file, rather something like this below:
I have a .txt with some text in it :rolleyes:
abc:123:xyz
123:abc:987... (7 Replies)
What is the best practice to allow a 3rd party health monitoring app to read the messages file. Since messages is a system file and is owned by root the app cannot read the file. I don't want to run the app as root so how should I allow the app to read the file. The read function is actually built... (2 Replies)
Discussion started by: slwiley
2 Replies
LEARN ABOUT DEBIAN
mail::field::received
Received(3pm) User Contributed Perl Documentation Received(3pm)NAME
Mail::Field::Received -- mostly RFC822-compliant parser of Received headers
SYNOPSIS
use Mail::Field;
my $received = Mail::Field->new('Received', $header);
my $results = $received->parse_tree();
my $parsed_ok = $received->parsed_ok();
my $diagnostics = $received->diagnostics();
DESCRIPTION
Don't use this class directly! Instead ask Mail::Field for new instances based on the field name!
Mail::Field::Received provides subroutines for parsing Received headers from e-mails. It mostly complies with RFC822, but deviates to
accommodate a number of broken MTAs which are in common use. It also attempts to extract useful information which MTAs often embed within
the "(comments)".
It is a subclass derived from the Mail::Field and Mail::Field::Generic classes.
ROUTINES
o debug
Returns current debugging level obtained via the "diagnostics" method. If a parameter is given, the debugging level is changed. The
default level is 3.
o diagnose
$received->diagnose("foo", "
");
Appends stuff to the parser's diagnostics buffer.
o diagnostics
my $diagnostics = $received->diagnostics();
Returns the contents of the parser's diagnostics buffer.
o parse
The actual parser. Returns the object (Mail::Field barfs otherwise).
o parsed_ok
if ($received->parsed_ok()) {
...
}
Returns true if the parse succeed, or if it failed, but was permitted to fail for some reason, such as encountering evidence of a known
broken (non-RFC822-compliant) format mid-parse.
o parse_tree
my $parse_tree = $received->parse_tree();
Returns the actual parse tree, which is where you get all the useful information. It is returned as a hashref whose keys are strings
like `from', `by', `with', `id', `via' etc., corresponding to the components of Received headers as defined by RFC822:
received = "Received" ":" ; one per relay
["from" domain] ; sending host
["by" domain] ; receiving host
["via" atom] ; physical path
*("with" atom) ; link/mail protocol
["id" msg-id] ; receiver msg id
["for" addr-spec] ; initial form
";" date-time ; time received
The corresponding values are more hashrefs which are mini-parse-trees for these individual components. A typical parse tree looks
something like:
{
'by' => {
'domain' => 'host5.hostingcheck.com',
'whole' => 'by host5.hostingcheck.com',
'comments' => [
'(8.9.3/8.9.3)'
],
},
'date_time' => {
'year' => 2000,
'week_day' => 'Tue',
'minute' => 57,
'day_of_year' => '1 Feb',
'month_day' => ' 1',
'zone' => '-0500',
'second' => 18,
'hms' => '21:57:18',
'date_time' => 'Tue, 1 Feb 2000 21:57:18 -0500',
'hour' => 21,
'month' => 'Feb',
'rest' => '2000 21:57:18 -0500',
'whole' => 'Tue, 1 Feb 2000 21:57:18 -0500'
},
'with' => {
'with' => 'ESMTP',
'whole' => 'with ESMTP'
},
'from' => {
'domain' => 'mediacons.tecc.co.uk',
'HELO' => 'tr909.mediaconsult.com',
'from' => 'tr909.mediaconsult.com',
'address' => '193.128.6.132',
'comments' => [
'(mediacons.tecc.co.uk [193.128.6.132])',
],
'whole' => 'from tr909.mediaconsult.com (mediacons.tecc.co.uk [193.128.6.132])
'
},
'id' => {
'id' => 'VAA24164',
'whole' => 'id VAA24164'
},
'comments' => [
'(mediacons.tecc.co.uk [193.128.6.132])',
'(8.9.3/8.9.3)'
],
'for' => {
'for' => '<adam@spiers.net>',
'whole' => 'for <adam@spiers.net>'
},
'whole' => 'from tr909.mediaconsult.com (mediacons.tecc.co.uk [193.128.6.132]) by host5.hostingcheck.com (8.9.3/8.9.3) with ESMTP id VAA24164 for <adam@spiers.net>; Tue, 1 Feb 2000 21:57:18 -0500'
}
BUGS
Doesn't use Parse::RecDescent, which it maybe should.
Doesn't offer a `strict RFC822' parsing mode. To implement that would be a royal pain in the arse, unless we move to Parse::RecDescent.
SEE ALSO
Mail::Field, Mail::Header
AUTHOR
Adam Spiers <adam@spiers.net>
LICENSE
All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl v5.10.1 2011-02-05 Received(3pm)