08-11-2003
modified it a little bit
i changed NF == 3 to NF == 2
but what if my data contains same NF?
for example, instead of "test01" i have "test01 testname"?
thanks,
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I want to write a shell script which increments a particular column in a row from a text file and then adds another row below the current row with the incremented value .
For Eg .
if the input file has a row :
abc xyz lmn 89 lm nk o p
I would like the script to create something like... (9 Replies)
Discussion started by: aYankeeFan
9 Replies
2. Shell Programming and Scripting
I want to write a scrpit to merge files row wise (actually concatinating)
main.txt
X Y Z
file 1
A B C
file 2
1 2 3
now i want the script to check if the file1 is empty or not, if empty then make it like
A B C
1 2 3
again to check if second file is empty if not do as done... (0 Replies)
Discussion started by: shashi792
0 Replies
3. UNIX for Dummies Questions & Answers
Hello Everyone,
My issue is that I want to traverse a database table row by row and do some action on the value retrieved in each row.
I have gone through a lot of shell script questions/posts. I could find row by row traversal of a file but not a database table.
Please help.
Thanks &... (5 Replies)
Discussion started by: ahsan.asghar
5 Replies
4. Shell Programming and Scripting
Hi Friends,
I have a single column data like below.
1
2
3
4
5
I need the output like below.
0
1
2
3
4
where each row (including first row) subtracting from first row and the result should print below like the way shown in output file.
Thanks
Sid (11 Replies)
Discussion started by: ks_reddy
11 Replies
5. Shell Programming and Scripting
Hi, I already succeed moving a new row to another table if the field from new row doesn't have the first word that I categorized (like: IRC blablabla, PTM blablabla, ADM blablabla, BS blablabla).
But it can't delete the old row. Please help me with the script.
my php script:
INSERT INTO... (2 Replies)
Discussion started by: jazzyzha
2 Replies
6. Shell Programming and Scripting
Hi.
How can we print those rows of file2 which are mentioned in file1. first character of file1 is a row number.. for eg
file1
1:abc
3:ghi
6:pqr
file2
a abc
b def
c ghi
d jkl
e mno
f pqr
... (6 Replies)
Discussion started by: Abhiraj Singh
6 Replies
7. Shell Programming and Scripting
HI Guys,
I have Below Input :-
RepigA_hteis522 ReptCfiEtrBsCll_aofe
MSL04_MSL2_A25_1A 0 9
MSL04_MSL2_A25_1B 0 9
MSL04_MSL2_A25_1C 0 9
RepigA ReptCfiEtrBsCll
hteis522 aofe
MSL04_MSL2_A25_1A 0 9
MSL04_MSL2_A25_1B 0 9
MSL04_MSL2_A25_1C 0 9
Split Data in two first row... (2 Replies)
Discussion started by: pareshkp
2 Replies
8. UNIX for Beginners Questions & Answers
My original files are like this below and I distinguish them from the AP_ID (file1 has 572 and file2 has 544). Also, the header on file1 has “G_” pre-pended. NOTE: these are only snippets of very large files and much of the data is not present here.
Original File 1:
... (36 Replies)
Discussion started by: aachave1
36 Replies
9. Shell Programming and Scripting
Hi ALL,
We have requirement in a file, i have multiple rows.
Example below:
Input file rows
01,1,102319,0,0,70,26,U,1,331,000000113200000011920000001212
01,1,102319,0,1,80,20,U,1,241,00000059420000006021
I need my output file should be as mentioned below. Last field should split for... (4 Replies)
Discussion started by: kotra
4 Replies
10. UNIX for Beginners Questions & Answers
This is a question that is related to one I had last August when I was trying to sort/merge two files by millsecond time column (in this case column 6).
The script (below) that helped me last august by RudiC solved the puzzle of sorting/merging two files by time, except it gets lost when the... (0 Replies)
Discussion started by: aachave1
0 Replies
LEARN ABOUT DEBIAN
hobbit
Hobbit(3pm) User Contributed Perl Documentation Hobbit(3pm)
NAME
Hobbit.pm -- Perl module to easily write Hobbit/Xymon tests
SYNOPSIS
use Hobbit;
my $bb = new Hobbit('testname');
if (somethings_is_not_so_good) {
$bb->color_line('yellow', 'Something is not so good');
}
if (somethings_is_really_bad) {
$bb->color_line('red', 'Something is really bad');
}
$bb->send();
DESCRIPTION
Hobbit.pm is part of the Debian package hobbit-plugins and was written to gather common tasks needed when writing tests for the Xymon
monitoring system (formerly known as Hobbit).
EXPORTABLE HELPER FUNCTIONS
@regexps = file_to_list_of_regexps($file)
@globs = file_to_list_of_globs($file)
INTERNAL FUNCTIONS
$max_color = max_color($color1, $color)
Out of two colors, returns the color with the highest severity.
METHODS
Constructor: new Hobbit('testname');
Constructor: new Hobbit({ test => 'testname', ttl => 60, ...});
Creates a new Hobbit object.
Common use cases
my $bb = new Hobbit('sometest');
my $bb = new Hobbit({ test => 'testname',
color => 'green',
hostname => 'host.example.com',
text => 'Test successful',
title => 'Some Test',
ttl => 60,
type => 'status',
dont_moan => 1 });
Available parameters
color
The initial color of the test. (Default: "clear")
dont_moan
Disable moan() and croak() (see below). Needed if e.g. another used Perl module throws a lot of warnings but works fine otherwise, etc.
hostname
The hostname for which the test should report. (Default: $ENV{CLIENTHOSTNAME} || $ENV{MACHINEDOTS} || $ENV{MACHINE} || 'unknown')
test
The name of the test, i.e. the name of the column on the hobbit status web pages. (Mandatory)
text
Text which is prepended to generated report. (Default: the empty string)
title
The summary of the test. (Default: "$test OK" respectively "$test NOT ok")
ttl
How long the test result is valid before the test state is changed to purple by the hobbit daemon if no newer test results have been
received.
The default value is set on the hobbit server and is 300 seconds by default.
Values without unit are interpreted as minutes. Valid units are h for hours, d for days, and w for weeks. No space between value and
unit allowed.
type
Allows one to send messages of other types than "status", e.g. data, notify, disable, enable, etc.
May not yet work with all of these types properly. Please report bugs via the Debian Bug Tracking system.
add_color('somecolor')
Minutes that a sub test caused the given color state. Adjusts the overall resulting color accordingly.
print_line('some text')
Adds the given text to the end of the current report without changing the current color.
color_print('somecolor', 'some text')
Adds the given text to the end of the current report and minutes that a sub test caused the given color state. Adjusts the overall
resulting color accordingly.
color_line('somecolor', 'some text')
Adds the given text to the end of the current report and minutes that a sub test caused the given color state. Prepends that text with an
accordingly colored Hobbit icon and adjusts the overall resulting color accordingly.
send()
Sends the report to the hobbit server.
INTERNAL METHODS
moan()
If the check issues a Perl warning, this warning is added to the report with color state "yellow".
Set dont_moan to 1 to disable this feature.
croak()
If the check issues a Perl error, this error is added to the report with color state "red".
Set dont_moan to 1 to disable this feature.
AUTHORS AND COPYRIGHT
Copyright (C) 2008-2011 Christoph Berg <myon@debian.org>
Copyright (C) 2011 Axel Beckert <abe@debian.org>
SEE ALSO
<http://www.xymon.org/> bb(5), hobbit(1)
perl v5.14.2 2013-01-09 Hobbit(3pm)