Sponsored Content
Top Forums Shell Programming and Scripting Parse for 2 numbers in large single line Post 303022156 by Don Cragun on Sunday 26th of August 2018 12:02:47 PM
Old 08-26-2018
If task doesn't return a useful exit code (i.e., always returns a zero exit status), one could still skip parsing counts and just loop until success is found:
Code:
while line=$(task)
do	if [ "$line" = "${line%:0\}}" ]
	then
		echo "One or more tests failed: $line"
	else
		echo "All tests passed: $line"
		break
	fi
done

This User Gave Thanks to Don Cragun For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to parse large numbers of shell scripts

I am trying to parse hundreds of shell scripts to determine how they related to each other. Ideally for every script, I would get an output of: What other scripts it calls What files it reads Environment variables it accesses Any ideas on how to do this? TIA! (2 Replies)
Discussion started by: bliss
2 Replies

2. AIX

Backup single large file

Hi I have a single large file 11gb that I need to copy/backup to tape then restore on another system. I tried tar but that complained about the file being too large Anyone have any suggestions how I can do this with AIX 5.2 Much appreciated. (3 Replies)
Discussion started by: Alvescot
3 Replies

3. Shell Programming and Scripting

A mistake in awk command I used to parse numbers

Hi I have a big file with a certain pattern (shown below) from which I need to parse out some digits in tabular format. The format of the file is: '-' indicates text which doesn't to be parsed # Output of huzzle for sequence file 1000.Clade1.html - - - -- -------... (2 Replies)
Discussion started by: Lucky Ali
2 Replies

4. Programming

Working with extremely large numbers in C

Hi All, I am just curious, not programming anything of my own. I know there are libraries like gmp which does all such things. But I really need to know HOW they do all such things i.e. working with extremely large unimaginable numbers which are beyond the integer limit. They can do add,... (1 Reply)
Discussion started by: shoaibjameel123
1 Replies

5. Shell Programming and Scripting

Parse large file on line count (random lines)

I have a file that needs to be parsed into multiple files every time there line contains a number 1. the problem i face is the lines are random and the file size is random. an example is that on line 4, 65, 187, 202 & 209 are number 1's so there has to be file breaks between all those to create 4... (6 Replies)
Discussion started by: darbs121
6 Replies

6. Shell Programming and Scripting

Parse a single line file and store value.

I have a single line file like this : Average Fragmentation Quotient : 3.084121 Now I want to store the value which comes after ":" i,e 3.084121 into a variable. And if this variable crosses above 6 i want to call another script... can any one help me on this... (7 Replies)
Discussion started by: Hyp_Todd
7 Replies

7. UNIX for Dummies Questions & Answers

Hope to create a file with two large column, with several numbers

I hope to create a file made up of 2 columns - first column print out number 0~61000 every 50 of it - second column just contains 0 delineated by space such as 0 0 50 0 100 0 150 0 200 0 ... 60900 0 60950 0 61000 0 Which command should I need to use? I think I might need to use... (5 Replies)
Discussion started by: exsonic
5 Replies

8. Shell Programming and Scripting

Adding Long List Of Large Numbers

Hi All, I have a file with long list of numbers. This file contains only one column. These numbers are very large. I am using following command: cat myfile.txt | awk '{ sum+=$1} END {print sum}' The output is coming in scientific notation. How do I get the result in proper format? ... (4 Replies)
Discussion started by: angshuman
4 Replies

9. Shell Programming and Scripting

How to add line breaks to perl command with large text in single quotes?

Below code extracts multiple field values from XML into array and prints all in one line. perl -nle '@r=/(?: jndiName| authDataAlias| value| minConnections| maxConnections| connectionTimeout| name)="(+)/g and print join ",",$ENV{tIPnSCOPE},$ENV{pr ovider},$ENV{impClassName},@r' server.xml ... (4 Replies)
Discussion started by: kchinnam
4 Replies

10. Shell Programming and Scripting

Need to parse the multiple definitions from a single line and assign

Hi, I need a help on my requirement that eg: NEED="TEST=Name WORK=Ps DEL=let" Here the definition can be n number, could anybody have an idea to get the output as, TEST=Name WORK=Ps DEL=let .. .. till the 'n' definitions listed. Any suggestions please..... Regards, ricky (6 Replies)
Discussion started by: ricky-row
6 Replies
Apache::Test(3) 					User Contributed Perl Documentation					   Apache::Test(3)

NAME
Apache::Test - Test.pm wrapper with helpers for testing Apache SYNOPSIS
use Apache::Test; DESCRIPTION
Apache::Test is a wrapper around the standard "Test.pm" with helpers for testing an Apache server. FUNCTIONS
plan This function is a wrapper around "Test::plan": plan tests => 3; just like using Test.pm, plan 3 tests. If the first argument is an object, such as an "Apache::RequestRec" object, "STDOUT" will be tied to it. The "Test.pm" global state will also be refreshed by calling "Apache::Test::test_pm_refresh". For example: plan $r, tests => 7; ties STDOUT to the request object $r. If there is a last argument that doesn't belong to "Test::plan" (which expects a balanced hash), it's used to decide whether to con- tinue with the test or to skip it all-together. This last argument can be: o a "SCALAR" the test is skipped if the scalar has a false value. For example: plan tests => 5, 0; But this won't hint the reason for skipping therefore it's better to use have(): plan tests => 5, have 'LWP', { "perl >= 5.7.3 is required" => sub { $] >= 5.007003 } }; see have() for more info. o an "ARRAY" reference have_module() is called for each value in this array. The test is skipped if have_module() returns false (which happens when at least one C or Perl module from the list cannot be found). o a "CODE" reference the tests will be skipped if the function returns a false value. For example: plan tests => 5, &have_lwp; the test will be skipped if LWP is not available All other arguments are passed through to Test::plan as is. ok Same as Test::ok, see Test.pm documentation. sok Allows to skip a sub-test, controlled from the command line. The argument to sok() is a CODE reference or a BLOCK whose return value will be passed to ok(). By default behaves like ok(). If all sub-tests of the same test are written using sok(), and a test is executed as: % ./t/TEST -v skip_subtest 1 3 only sub-tests 1 and 3 will be run, the rest will be skipped. skip Same as Test::skip, see Test.pm documentation. test_pm_refresh Normally called by Apache::Test::plan, this function will refresh the global state maintained by Test.pm, allowing "plan" and friends to be called more than once per-process. This function is not exported. Functions that can be used as a last argument to the extended plan(): plan tests => 5, &have_http11; Require HTTP/1.1 support. have_ssl plan tests => 5, &have_ssl; Require SSL support. Not exported by default. have_lwp plan tests => 5, &have_lwp; Require LWP support. have_cgi plan tests => 5, &have_cgi; Requires mod_cgi or mod_cgid to be installed. have_apache plan tests => 5, have_apache 2; Requires httpd-2.x (apache-2.x). plan tests => 5, have_apache 1; Requires apache-1.3.x. have_perl plan tests => 5, have_perl 'iolayers'; plan tests => 5, have_perl 'ithreads'; Requires a perl extension to be present, or perl compiled with certain capabilities. The first example tests whether "PerlIO" is available, the second whether: $Config{useithread} eq 'define'; have_module plan tests => 5, have_module 'CGI'; plan tests => 5, have_module qw(CGI Find::File); plan tests => 5, have_module ['CGI', 'Find::File', 'cgid']; Requires Apache C and Perl modules. The function accept a list of arguments or a reference to a list. In case of C modules, depending on how the module name was passed it may pass through the following completions: 1 have_module 'proxy_http.c' If there is the .c extension, the module name will be looked up as is, i.e. 'proxy_http.c'. 2 have_module 'mod_cgi' The .c extension will be appended before the lookup, turning it into 'mod_cgi.c'. 3 have_module 'cgi' The .c extension and mod_ prefix will be added before the lookup, turning it into 'mod_cgi.c'. have plan tests => 5, have 'LWP', { "perl >= 5.7.3 is required" => sub { $] >= 5.007003 } }, { "not Win32" => sub { $^O eq 'MSWin32' } }, 'cgid'; have() is more generic function which can impose multiple requirements at once. All requirements must be satisfied. have()'s argument is a list of things to test. The list can include scalars, which are passed to have_module(), and hash references. The hash references have a condition code reference as a value and a reason for failure as a key. The condition code is run and if it fails the provided reason is used to tell user why the test was skipped. In the presented example, we require the presense of the "LWP" Perl module, "mod_cgid", that we run under perl >= 5.7.3 on Win32. It's possible to put more than one requirement into a single hash reference, but be careful that the keys will be different: have 'LWP', { "perl >= 5.7.3 is required" => sub { $] >= 5.007003 }, "not Win32" => sub { $^O eq 'MSWin32' }, }, 'cgid'; Also see plan(). Apache::TestToString Class The Apache::TestToString class is used to capture Test.pm output into a string. Example: Apache::TestToString->start; plan tests => 4; ok $data eq 'foo'; ... # $tests will contain the Test.pm output: 1..4 ok 1 ... my $tests = Apache::TestToString->finish; perl v5.8.0 2002-09-10 Apache::Test(3)
All times are GMT -4. The time now is 01:10 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy