I have the following script:
set DAY=`date +%y%m%d`
set H=`date +%H`
set M=`date +%M`
awk 'NR==1 {printf "MY HEADER WITH TIME STAMP $H \n"} {print $0}' data1> data2
my result is:
MY HEADER WITH TIME STAMP $H
......data information....
......data information....
How can I get... (1 Reply)
Greetings all,
...here is yet another string of awk/sed questions from a RegExp-Challenged luser :eek:
I'm looking to have sed/awk do some clean-up on routing tables and to that end, I would like to do the following:
1.) If a line contains the word "masks" or "subnets" prepend CR/LF to... (16 Replies)
Hi guys. I need to filter some values from a number of log files. One of the files is:
Interconnect Utilisation Results:
Achieved Maximum Number of Concurrent Connections: 17
Statistics for Average Number of Concurrent Connections:
Point Estimation: Confidence Interval: ... (2 Replies)
1.) I am to write scripts that will be phasetest folder in the home directory.
2.) The folder should have a set-up,phase and display files
I have written a small script which i used to check for the existing users and their password.
What I need help with:
I have a set of questions in a... (19 Replies)
I find an script with awk sitting around. I went through some online manuals, but I can't figure out exactly how it works. I can't post the whole program. Not allowed.
This is the line that is confusing me. I get when else is in the script
grep -v "^REM " $1| grep -v "JUNK;" | awk -F" "... (2 Replies)
Hi Guys,
This is the Input:
<xn:MeContext id="XXX012">
<xn:ManagedElement id="1">
<xn:attributes>
<xn:userLabel>XXX012</xn:userLabel>
<xn:swVersion>R58E68</xn:swVersion>
</xn:attributes>
</xn:ManagedElement>
</xn:MeContext>... (4 Replies)
I have an unfortunate need to redo a bunch of disk settings on a VIOS on AIX, so I was putting together a quick script to scrub everything it has, make the changes, and then put the mappings back. It works, I just am trying to get my awk a bit more up-to-snuff and wanted to know the proper way to... (2 Replies)
Hi All,
I have a file in the format shown below. I need to pick up only those lines which have the highest value in column 4 , based on column1.
The lines marked as bold should be the output. Any help is appreciated!
Input file :
-10.5|6|L|32|MPP||R||012009|E... (12 Replies)
Hello Experts..
I have 3-4 C codes with Oracle SQL statements embedded. All the SQL statements starts with EXEC SQL keyword and ends with ;. I want to extract all the SQL statements out of these codes.
I did awk '/^EXEC SQL/,/\;/' inputFile (I use this on all of the codes individually). That... (2 Replies)
1. The problem statement, all variables and given/known data:
So i'll probably get told off for this but I have a few problems and rather than clog up the whole forum I'll post them here. Please bare in mind I am a complete novice when it comes to all this and so if you help please treat me like a... (4 Replies)
Discussion started by: jamesb18
4 Replies
LEARN ABOUT DEBIAN
test::data::scalar
Scalar(3pm) User Contributed Perl Documentation Scalar(3pm)NAME
Test::Data::Scalar -- test functions for scalar variables
SYNOPSIS
use Test::Data qw(Scalar);
DESCRIPTION
This modules provides a collection of test utilities for scalar variables. Load the module through Test::Data.
Functions
blessed_ok( SCALAR )
Ok if the SCALAR is a blessed reference.
defined_ok( SCALAR )
Ok if the SCALAR is defined.
undef_ok( SCALAR )
Ok if the SCALAR is undefined.
dualvar_ok( SCALAR )
Ok if the scalar is a dualvar.
How do I test this?
sub dualvar_ok ($;$) { my $ok = Scalar::Util::dualvar( $_[0] ); my $name = $_[1] || 'Scalar is a dualvar';
$Test->ok( $ok, $name );
$Test->diag("Expected a dualvar, didn't get it
")
unless $ok;
}
greater_than( SCALAR, BOUND )
Ok if the SCALAR is numerically greater than BOUND.
length_ok( SCALAR, LENGTH )
Ok if the length of SCALAR is LENGTH.
less_than( SCALAR, BOUND )
Ok if the SCALAR is numerically less than BOUND.
maxlength_ok( SCALAR, LENGTH )
Ok is the length of SCALAR is less than or equal to LENGTH.
minlength_ok( SCALAR, LENGTH )
Ok is the length of SCALAR is greater than or equal to LENGTH.
number_ok( SCALAR )
Ok if the SCALAR is a number ( or a string that represents a number ).
At the moment, a number is just a string of digits. This needs work.
number_between_ok( SCALAR, LOWER, UPPER )
Ok if the number in SCALAR sorts between the number in LOWER and the number in UPPER, numerically.
If you put something that isn't a number into UPPER or LOWER, Perl will try to make it into a number and you may get unexpected
results.
string_between_ok( SCALAR, LOWER, UPPER )
Ok if the string in SCALAR sorts between the string in LOWER and the string in UPPER, ASCII-betically.
readonly_ok( SCALAR )
Ok is the SCALAR is read-only.
ref_ok( SCALAR )
Ok if the SCALAR is a reference.
ref_type_ok( REF1, REF2 )
Ok if REF1 is the same reference type as REF2.
strong_ok( SCALAR )
Ok is the SCALAR is not a weak reference.
tainted_ok( SCALAR )
Ok is the SCALAR is tainted.
(Tainted values may seem like a not-Ok thing, but remember, when you use taint checking, you want Perl to taint data, so you should
have a test to make sure it happens.)
untainted_ok( SCALAR )
Ok if the SCALAR is not tainted.
weak_ok( SCALAR )
Ok if the SCALAR is a weak reference.
TO DO
* add is_a_filehandle test
* add is_vstring test
SEE ALSO
Scalar::Util, Test::Data, Test::Data::Array, Test::Data::Function, Test::Data::Hash, Test::Builder
SOURCE AVAILABILITY
This source is in Github:
http://github.com/briandfoy/test-data/tree/master
AUTHOR
brian d foy, "<bdfoy@cpan.org>"
COPYRIGHT AND LICENSE
Copyright (c) 2002-2009 brian d foy. 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.14.2 2009-02-12 Scalar(3pm)