10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi All,
Seeking for your assistance on how to ouput the file which is not match in file 1 and file 2 using awk. I tried NR=FNR but it's not working, it will only show the match record.
Ex.
File1
abc
def
ghi
File2
23a
gd
abc
Output:
abc (2 Replies)
Discussion started by: znesotomayor
2 Replies
2. Shell Programming and Scripting
Hi All,
I have a output like below
$ cat aa.lst
Value of output parameters
---------------------------------------
Parameter Name : SNAPSHOTTIMESTAMP
Parameter Value : 2014-01-07-15.21.50.022423
Parameter Name : DATABASESIZE
Parameter Value : 96178176
... (2 Replies)
Discussion started by: kamauv234
2 Replies
3. Shell Programming and Scripting
Hi Guys,
I need to append some data to a new file, but i need to make sure that when i use to >> command again.I dont go to the new line. i append the data on the same line.
Please help regarding the same.
Thanks in advance..!!! (3 Replies)
Discussion started by: jaituteja
3 Replies
4. Shell Programming and Scripting
I have this input file
Switch 0; Sun Sep 11 12:40:53 2011 EDT (GMT+4:00)
12:40:53.159984 SCN Port Offline;g=0x1e4b6 A2,P0 A2,P0 379 NA
12:40:53.159991 *Removing all nodes from port A2,P0 A2,P0 379 NA
18:45:31.326604 Port Elp engaged ... (1 Reply)
Discussion started by: greycells
1 Replies
5. Shell Programming and Scripting
Hi all ,
I have a view in teradata , the ouput of that view have to be stored as a file with delimitere as '|'.Is there any possibility of doing this in unix ?
Thanks in advance ,
Vinoth (6 Replies)
Discussion started by: vino.paal
6 Replies
6. UNIX for Dummies Questions & Answers
I have follwoing text file as alarm dump.
A1/EXT "B25I11K0150_F W" 512 090629 1121
RADIO X-CEIVER ADMINISTRATION
BTS EXTERNAL FAULT
MO RSITE CLASS
RXOCF-405 DKRD01_INDS 1
EXTERNAL ALARM
MAINS FAIL ... (1 Reply)
Discussion started by: lalchand
1 Replies
7. Shell Programming and Scripting
Hello experts,
I'm testing a program that prints error message to the screen.
I want to redirect the output to a file using >. but the message only prints on screen and not writing to the file,
Any suggestion on what I might try? (3 Replies)
Discussion started by: minifish
3 Replies
8. Windows & DOS: Issues & Discussions
I used printf to print the following under SFU,
lrs=`cat lrs`
hrs=`cat hrs`
tp=`cat tp`
printf “\n\n%5sM = $lrs Ohms%5sX = $hrs Ohms%5sT = $tp %%\n\n\n” > file
cat file
With the above script, I used %% after $tp only as a percentage sign and I get only the following output:
% T =... (5 Replies)
Discussion started by: ilak1008
5 Replies
9. Shell Programming and Scripting
Hi all,
I have a list of data below.
As long as there are same character in the 1st column (eg xxx ), i would want to add all the numbers in the 3rd column and display as the output below so the total would be 10+20+30 = 60. Can anybody help to do this using nawk? Using solaris by the way. ... (12 Replies)
Discussion started by: Raynon
12 Replies
10. UNIX for Dummies Questions & Answers
Red Hat 7.2
On command line.. i need to ouput or capture just..
CPE3236313839393 Fri Nov 1 00:05 - 00:05 (00:00)
the time inside the brackets (00:00) ... i havea list of about a hundred from sperate dates in a long file.
I need to some how grep or i dunno all times from Nov 1 and... (3 Replies)
Discussion started by: juxtaman
3 Replies
IO::Capture::Stderr(3pm) User Contributed Perl Documentation IO::Capture::Stderr(3pm)
NAME
"IO::Capture::Stderr" - Capture all output sent to "STDERR"
SYNOPSIS
use IO::Capture::Stderr;
$capture = IO::Capture::Stderr->new();
$capture->start(); # STDERR Output captured
print STDERR "Test Line One
";
print STDERR "Test Line Two
";
print STDERR "Test Line Three
";
$capture->stop(); # STDERR output sent to wherever it was before 'start'
# In 'scalar context' returns next line
$line = $capture->read;
print "$line"; # prints "Test Line One"
$line = $capture->read;
print "$line"; # prints "Test Line Two"
# move line pointer to line 1
$capture->line_pointer(1);
$line = $capture->read;
print "$line"; # prints "Test Line One"
# Find out current line number
$current_line_position = $capture->line_pointer;
# In 'List Context' return an array(list)
@all_lines = $capture->read;
# Example 1 - "Using in module tests"
# Note: If you don't want to make users install
# the IO::Capture module just for your tests,
# you can just install in the t/lib directory
# of your module and use the lib pragma in
# your tests.
use lib "t/lib";
use IO::Capture:Stderr;
use Test::More;
# Create new capture object. Showing FORCE_CAPTURE_WARN being cleared
# for example, but 0 is the default, so you don't need to specify
# unless you want to set.
my $capture = IO::Capture:Stderr->new( {FORCE_CAPTURE_WARN => 0} );
$capture->start
# execute with a bad parameter to make sure get
# an error.
ok( ! $test("Bad Parameter") );
$capture->stop();
DESCRIPTION
The module "IO::Capture::Stderr", is derived from the abstract class "IO::Capture". See IO::Capture. The purpose of the module (as the
name suggests) is to capture any output sent to "STDOUT". After the capture is stopped, the STDOUT filehandle will be reset to the previ-
ous location. E.g., If previously redirected to a file, when "IO::Capture->stop" is called, output will start going into that file again.
Note: This module won't work with the perl function, system(), or any other operation
involving a fork(). If you want to capture the output from a system command,
it is faster to use open() or back-ticks.
my $output = `/usr/sbin/ls -l 2>&1`;
METHODS
new
o Creates a new capture object.
o An object can be reused as needed, so will only need to do one of these.
o Be aware, any data previously captured will be discarded if a new capture session is started.
start
o Start capturing data into the "IO::Capture" Object.
o Can not be called on an object that is already capturing.
o Can not be called while STDERR tied to an object.
o "undef" will be returned on an error.
stop
o Stop capturing data and point STDERR back to it's previous output location I.e., untie STDERR
read
o In Scalar Context
o Lines are read from the buffer at the position of the "line_pointer", and the pointer is incremented by one.
$next_line = $capture->read;
o In List Context
o The array is returned. The "line_pointer" is not affected.
@buffer = $capture->read;
o Data lines are returned exactly as they were captured. You may want to use "chomp" on them if you don't want the end of line charac-
ter(s)
while (my $line = $capture->read) {
chomp $line;
$cat_line = join '', $cat_line, $line;
}
line_pointer
o Reads or sets the "line_pointer".
my $current_line = $capture->line_pointer;
$capture->line_pointer(1);
ARGUMENTS
Pass any arguments to new() in a single array reference.
IO::Capture::Stderr->new( {FORCE_CAPTURE_WARN => 1} );
FORCE_CAPTURE_WARN
Normally, IO::Capture::Stderr will capture text from warn() function calls. This is because output from warn() is normally directed to
STDERR. If you wish to force IO::Capture::Stderr to grab the text from warn(), set FORCE_CAPTURE_WARN to a 1. Then "IO::Cap-
ture::Stderr" will save the handle that $SIG{__WARN__} was set to, redirect it to itself on "start()", and then set $SIG{__WARN__} back
after "stop()" is called.
SUB-CLASSING
Adding Features
If you would like to sub-class this module to add a feature (method) or two, here is a couple of easy steps. Also see IO::Capture::Over-
view.
1 Give your package a name
package MyPackage;
2 Use this "IO::Capture::Stderr" as your base class like this:
package MyPackage;
use base qw/IO::Capture::Stderr/;
3 Add your new method like this
package MyPackage;
use base qw/IO::Capture::Stderr/;
sub grep {
my $self = shift;
for $line (
}
See Also
IO::Capture::Overview
IO::Capture
IO::Capture::Stdout
AUTHORS
Mark Reynolds reynolds@sgi.com
Jon Morgan jmorgan@sgi.com
COPYRIGHT
Copyright (c) 2003, Mark Reynolds. All Rights Reserved. This module is free software. It may be used, redistributed and/or modified under
the same terms as Perl itself.
perl v5.8.8 2007-07-30 IO::Capture::Stderr(3pm)