Sponsored Content
Full Discussion: Row alignment
Top Forums Shell Programming and Scripting Row alignment Post 302911284 by Don Cragun on Thursday 31st of July 2014 12:33:03 AM
Old 07-31-2014
Chubler_XL made a reasonable guess at what may be wanted. The specification leaves a lot to be desired:
  1. Are there always only two lines?
  2. Is the FAIL always on the 2nd line? Or, if there can be more than two lines, always on the last line?
  3. Is the FAIL always further to the right on a line than all occurrences of PASS?
  4. Will there every be any text following PASS?
  5. Will there ever be more than one FAIL line?
  6. How big can the file we're processing be?
  7. Will there always be a FAIL line?

Last edited by Don Cragun; 07-31-2014 at 01:34 AM.. Reason: Add another question.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Changing the column for a row in a text file and adding another row

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. UNIX for Dummies Questions & Answers

Shell Script: Traverse Database Table Row by Row

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

3. Shell Programming and Scripting

Subtracting each row from the first row in a single column file using awk

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

4. Shell Programming and Scripting

In php, Moving a new row to another table and deleting old row

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

5. Emergency UNIX and Linux Support

[Solved] Mysql - Take data from row and copy it to another row

Sorry if I repost my question in this section, but I'm really in a hurry since I have to finish my work... :( Dear community, I have a table with two rows like: Row1 Row2 ======= ======= 7,3 text 1 1,3 text 2 1,2,3 blabla What i need to do is add/copy... (2 Replies)
Discussion started by: Lord Spectre
2 Replies

6. Shell Programming and Scripting

Get row number from file1 and print that row of file2

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

Add Row from First Row (Split Row)

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

Keep only the closet match of timestamped row (include headers) from file1 to precede file2 row/s

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

Splitting single row into multiple rows based on for every 10 digits of last field of the row

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

Keep only the closet match of timestamped row (include headers) from file1 to precede file2 row/s

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
More(3pm)						User Contributed Perl Documentation						 More(3pm)

NAME
Carp::Assert::More - convenience wrappers around Carp::Assert VERSION
Version 1.12 SYNOPSIS
use Carp::Assert::More; my $obj = My::Object; assert_isa( $obj, 'My::Object', 'Got back a correct object' ); DESCRIPTION
Carp::Assert::More is a set of wrappers around the Carp::Assert functions to make the habit of writing assertions even easier. Everything in here is effectively syntactic sugar. There's no technical reason to use assert_isa( $foo, 'HTML::Lint' ); instead of assert( defined $foo ); assert( ref($foo) eq 'HTML::Lint' ); other than readability and simplicity of the code. My intent here is to make common assertions easy so that we as programmers have no excuse to not use them. CAVEATS
I haven't specifically done anything to make Carp::Assert::More be backwards compatible with anything besides Perl 5.6.1, much less back to 5.004. Perhaps someone with better testing resources in that area can help me out here. SIMPLE ASSERTIONS
assert_is( $string, $match [,$name] ) Asserts that $string matches $match. assert_isnt( $string, $unmatch [,$name] ) Asserts that $string does NOT match $unmatch. assert_like( $string, qr/regex/ [,$name] ) Asserts that $string matches qr/regex/. assert_defined( $this [, $name] ) Asserts that $this is defined. assert_nonblank( $this [, $name] ) Asserts that $this is not blank and not a reference. NUMERIC ASSERTIONS
assert_integer( $this [, $name ] ) Asserts that $this is an integer, which may be zero or negative. assert_integer( 0 ); # pass assert_integer( -14 ); # pass assert_integer( '14.' ); # FAIL assert_nonzero( $this [, $name ] ) Asserts that the numeric value of $this is not zero. assert_nonzero( 0 ); # FAIL assert_nonzero( -14 ); # pass assert_nonzero( '14.' ); # pass Asserts that the numeric value of $this is not zero. assert_positive( $this [, $name ] ) Asserts that the numeric value of $this is greater than zero. assert_positive( 0 ); # FAIL assert_positive( -14 ); # FAIL assert_positive( '14.' ); # pass assert_nonnegative( $this [, $name ] ) Asserts that the numeric value of $this is greater than or equal to zero. Since non-numeric strings evaluate to zero, this means that any non-numeric string will pass. assert_nonnegative( 0 ); # pass assert_nonnegative( -14 ); # FAIL assert_nonnegative( '14.' ); # pass assert_nonnegative( 'dog' ); # pass assert_negative( $this [, $name ] ) Asserts that the numeric value of $this is less than zero. assert_negative( 0 ); # FAIL assert_negative( -14 ); # pass assert_negative( '14.' ); # FAIL assert_nonzero_integer( $this [, $name ] ) Asserts that the numeric value of $this is not zero, and that $this is an integer. assert_nonzero_integer( 0 ); # FAIL assert_nonzero_integer( -14 ); # pass assert_nonzero_integer( '14.' ); # FAIL assert_positive_integer( $this [, $name ] ) Asserts that the numeric value of $this is greater than zero, and that $this is an integer. assert_positive_integer( 0 ); # FAIL assert_positive_integer( -14 ); # FAIL assert_positive_integer( '14.' ); # FAIL assert_positive_integer( '14' ); # pass assert_nonnegative_integer( $this [, $name ] ) Asserts that the numeric value of $this is not less than zero, and that $this is an integer. assert_nonnegative_integer( 0 ); # pass assert_nonnegative_integer( -14 ); # pass assert_nonnegative_integer( '14.' ); # FAIL assert_negative_integer( $this [, $name ] ) Asserts that the numeric value of $this is less than zero, and that $this is an integer. assert_negative_integer( 0 ); # FAIL assert_negative_integer( -14 ); # pass assert_negative_integer( '14.' ); # FAIL REFERENCE ASSERTIONS
assert_isa( $this, $type [, $name ] ) Asserts that $this is an object of type $type. assert_nonempty( $this [, $name ] ) $this must be a ref to either a hash or an array. Asserts that that collection contains at least 1 element. Will assert (with its own message, not $name) unless given a hash or array ref. It is OK if $this has been blessed into objecthood, but the semantics of checking an object to see if it has keys (for a hashref) or returns >0 in scalar context (for an array ref) may not be what you want. assert_nonempty( 0 ); # FAIL assert_nonempty( 'foo' ); # FAIL assert_nonempty( undef ); # FAIL assert_nonempty( {} ); # FAIL assert_nonempty( [] ); # FAIL assert_nonempty( {foo=>1} );# pass assert_nonempty( [1,2,3] ); # pass assert_nonref( $this [, $name ] ) Asserts that $this is not undef and not a reference. assert_hashref( $ref [,$name] ) Asserts that $ref is defined, and is a reference to a (possibly empty) hash. NB: This method returns false for objects, even those whose underlying data is a hashref. This is as it should be, under the assumptions that: (a) you shouldn't rely on the underlying data structure of a particular class, and (b) you should use "assert_isa" instead. assert_listref( $ref [,$name] ) Asserts that $ref is defined, and is a reference to a (possibly empty) list. NB: The same caveat about objects whose underlying structure is a hash (see "assert_hashref") applies here; this method returns false even for objects whose underlying structure is an array. SET AND HASH MEMBERSHIP
assert_in( $string, @inlist [,$name] ); Asserts that $string is defined and matches one of the elements of @inlist. @inlist must be an array reference of defined strings. assert_exists( \%hash, $key [,$name] ) assert_exists( \%hash, @keylist [,$name] ) Asserts that %hash is indeed a hash, and that $key exists in %hash, or that all of the keys in @keylist exist in %hash. assert_exists( \%custinfo, 'name', 'Customer has a name field' ); assert_exists( \%custinfo, [qw( name addr phone )], 'Customer has name, address and phone' ); assert_lacks( \%hash, $key [,$name] ) assert_lacks( \%hash, @keylist [,$name] ) Asserts that %hash is indeed a hash, and that $key does NOT exist in %hash, or that none of the keys in @keylist exist in %hash. assert_lacks( \%users, 'root', 'Root is not in the user table' ); assert_lacks( \%users, [qw( root admin nobody )], 'No bad usernames found' ); UTILITY ASSERTIONS
assert_fail( [$name] ) Assertion that always fails. "assert_fail($msg)" is exactly the same as calling "assert(0,$msg)", but it eliminates that case where you accidentally use "assert($msg)", which of course never fires. COPYRIGHT
Copyright (c) 2005 Andy Lester. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. ACKNOWLEDGEMENTS
Thanks to Bob Diss, Pete Krawczyk, David Storrs, Dan Friedman, and Allard Hoeve for code and fixes. perl v5.8.8 2005-10-14 More(3pm)
All times are GMT -4. The time now is 07:51 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy