12-18-2008
Variable
Hi ,
If "c.log" is a file. This file contains a number.
How to assign the content of file "c.log" as a variable ?
Please guide
regards
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
This is what I tried:
vara=${varb}_count
(( vara += 1 ))
Thanks for help (4 Replies)
Discussion started by: pa3be
4 Replies
2. Shell Programming and Scripting
Hello,
i have another sed question.. I'm trying to do variable substition with sed and i'm running into a problem.
my var1 is a string constructed like this:
filename1 filerev1 filepath1
my var2 is another string constructed like this:
filename2 filerev2 filepath2
when i do... (2 Replies)
Discussion started by: alrinno
2 Replies
3. Shell Programming and Scripting
I want to instert Category:XXXXX into the 2. line
something like this should work, but I have somewhere the wrong sytanx. something with the linebreak goes wrong:
sed "2i\\${n}Category:$cat\n"
Sample:
Titel Blahh Blahh abllk sdhsd sjdhf
Blahh Blah Blahh
Blahh
Should look like... (2 Replies)
Discussion started by: lowmaster
2 Replies
4. Shell Programming and Scripting
Hi all,
I have a variable say var1 (output from somewhere, which I can't change)which store something like this:
echo $var1
name=fred
age=25
address="123 abc"
password=pass1234
how can I make the variable $name, $age, $address and $password contain the info?
I mean do this in a... (1 Reply)
Discussion started by: freddy1228
1 Replies
5. Shell Programming and Scripting
Dear all,
I have basic knowledge of Unix script and her I am trying to process variable length and variable format CSV file.
The file length will depend on the numbers of Earnings/Deductions/Direct Deposits.
And
The format will depend on whether it is Earnings/Deductions or Direct Deposits... (2 Replies)
Discussion started by: chechun
2 Replies
6. Shell Programming and Scripting
Hi,
I am trying to do the following thing
var='date'
$var
Above command substitutes date for and in turn runs the date command and i am getting the todays date value.
I am trying to do the same thing as following, but facing some problems,
unique_host_pro="sed -e ' /#/d'... (3 Replies)
Discussion started by: gvinayagam
3 Replies
7. Shell Programming and Scripting
can anyone please help me with this:
i have written a shell script and a stored procedure which has one OUT parameter. now i want to use that out parameter as an input to the unix script but i am getting an error as variable not found. below are the unix scripts and stored procedure...
... (4 Replies)
Discussion started by: swap21783
4 Replies
8. Red Hat
Hi all,
Hereby wish to have your advise for below:
Main concept is
I intend to get current directory of my script file.
This script file will be copied to /etc/init.d.
A string in this copy will be replaced with current directory value.
Below is original script file:
... (6 Replies)
Discussion started by: cielle
6 Replies
9. Shell Programming and Scripting
Hi All,
I have a file which has hundred of records with fixed number of fields. In each record there is set of 8 characters which represent the duration of that activity. I want to sum up the duration present in all the records for a report. The problem is the duration changes per record so I... (5 Replies)
Discussion started by: danish0909
5 Replies
10. UNIX for Advanced & Expert Users
I have a below syntax its working fine...
var12=$(ps -ef | grep apache | awk '{print $2,$4}')
Im getting expected output as below:
printf "%b\n" "${VAR12}"
dell 123
dell 456
dell 457
Now I wrote a while loop.. the output of VAR12 should be passed as input parameters to while loop and results... (5 Replies)
Discussion started by: sam@sam
5 Replies
LEARN ABOUT DEBIAN
mojo::log
Mojo::Log(3pm) User Contributed Perl Documentation Mojo::Log(3pm)
NAME
Mojo::Log - Simple logger
SYNOPSIS
use Mojo::Log;
# Log to STDERR
my $log = Mojo::Log->new;
# Customize log file location and minimum log level
my $log = Mojo::Log->new(path => '/var/log/mojo.log', level => 'warn');
# Log messages
$log->debug("Why isn't this working?");
$log->info("FYI: it happened again");
$log->warn("This might be a problem");
$log->error("Garden variety error");
$log->fatal("Boom!");
DESCRIPTION
Mojo::Log is a simple logger for Mojo projects.
EVENTS
Mojo::Log can emit the following events.
"message"
$log->on(message => sub {
my ($log, $level, @messages) = @_;
...
});
Emitted when a new message gets logged.
$log->unsubscribe('message');
$log->on(message => sub {
my ($log, $level, @messages) = @_;
say "$level: ", @messages;
});
ATTRIBUTES
Mojo::Log implements the following attributes.
"handle"
my $handle = $log->handle;
$log = $log->handle(IO::Handle->new);
Log file handle used by default "message" event, defaults to opening "path" or "STDERR".
"level"
my $level = $log->level;
$log = $log->level('debug');
Active log level, defaults to the value of the "MOJO_LOG_LEVEL" environment variable or "debug".
These levels are currently available:
"debug"
"info"
"warn"
"error"
"fatal"
"path"
my $path = $log->path
$log = $log->path('/var/log/mojo.log');
Log file path used by "handle".
METHODS
Mojo::Log inherits all methods from Mojo::EventEmitter and implements the following new ones.
"new"
my $log = Mojo::Log->new;
Construct a new Mojo::Log object and subscribe to "message" event with default logger.
"debug"
$log = $log->debug('You screwed up, but that is ok');
Log debug message.
"error"
$log = $log->error('You really screwed up this time');
Log error message.
"fatal"
$log = $log->fatal('Its over...');
Log fatal message.
"format"
my $message = $log->format('debug', 'Hi there!');
my $message = $log->format('debug', 'Hi', 'there!');
Format log message.
"info"
$log = $log->info('You are bad, but you prolly know already');
Log info message.
"is_level"
my $success = $log->is_level('debug');
Check log level.
"is_debug"
my $success = $log->is_debug;
Check for debug log level.
"is_error"
my $success = $log->is_error;
Check for error log level.
"is_fatal"
my $success = $log->is_fatal;
Check for fatal log level.
"is_info"
my $success = $log->is_info;
Check for info log level.
"is_warn"
my $success = $log->is_warn;
Check for warn log level.
"log"
$log = $log->log(debug => 'This should work');
Emit "message" event.
"warn"
$log = $log->warn('Dont do that Dave...');
Log warn message.
SEE ALSO
Mojolicious, Mojolicious::Guides, <http://mojolicio.us>.
perl v5.14.2 2012-09-05 Mojo::Log(3pm)