Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Awk_ printing non-match in the array Post 303041650 by arsalane on Saturday 30th of November 2019 03:18:46 PM
Old 11-30-2019
Thanks ! There is only a minor issue that is prints 'zero' in the front of the match as well :
Code:
abc 0
ddd 0
cnn 0

Ideally it should be
Code:
abc 
ddd 0
cnn 0

--- Post updated at 09:18 PM ---

Solved, Thank you!

Last edited by vbe; 11-30-2019 at 04:32 PM.. Reason: code tags please
 

10 More Discussions You Might Find Interesting

1. Programming

printing all array values using dbx 7.2.1

how do we print the entire contents of arrays in dbx ? Ive tried using print x to print values 1 to 5 of the array x, however dbx complains and doesnt allow this help is much appreciated (1 Reply)
Discussion started by: JamesGoh
1 Replies

2. Shell Programming and Scripting

Array Printing Inline

Dear friends , The output file of below script Pls#!/bin/sh awk '{ bo = substr($0,13,3) slm = substr($0,150,8) slo = substr($0,175,7) inc = substr($0,97,10)/100 busi = substr($0,83,10) mth = substr($0,39,2) yer = substr($0,35,4) ... (2 Replies)
Discussion started by: vakharia Mahesh
2 Replies

3. Shell Programming and Scripting

Perl: Printing Multiple Lines after pattern match

Hello People, Need some assistance/guidance. OUTLINE: Two files (File1 and File2) File1 has some ids such as 009463_3922_1827 897654_8764_5432 File2 has things along the lines of: Query= 009463_3922_1827 length=252 (252 letters) More stufff here ... (5 Replies)
Discussion started by: Deep9000
5 Replies

4. Shell Programming and Scripting

printing words based on column match

pls help Input: file1 word1 text1 word2 text2 word3 text3 file2 word1 text11 word3 text13 can u pls help in getting the same output: file1 text1 text2 text3 (1 Reply)
Discussion started by: bha148
1 Replies

5. UNIX for Dummies Questions & Answers

Help with printing sorted array of numbers

Dear All, I am trying to sort an array of numbers to retrieve the mimimum and maximum values of numbers in that array, by printing the first and last elements of the sorted array. My code is @sorted_numbers = sort (@numbers); print "@sorted_numbers\n"; print "$sorted_numbers,... (0 Replies)
Discussion started by: pawannoel
0 Replies

6. UNIX for Dummies Questions & Answers

printing array elements

Is there a way to print multiple array elements without iterating through the array using bash? Can you do something like... echo ${array}and get all those separate elements from the array? (2 Replies)
Discussion started by: jrymer
2 Replies

7. Shell Programming and Scripting

Printing next 6 lines from of pattern match

Hi, i have a big file having many opcodes. if (opcode="01110000000100000000" ) then --fadd result.opcode := "01110000000100000000"; result.s0 := '1'; result.s1 := '1'; result.s2 := '0'; result.inst := '0'; result.scalar := '1';... (7 Replies)
Discussion started by: twistedpair
7 Replies

8. Shell Programming and Scripting

Variable substitution in array printing

Hi folks, A really dumb question as I've wasted far too long trying to get this to work.... (on RH bash) I have an array: m0='<hello>' m0='<there>' m0='<fred>' v0='<goodbye>' v0='<again>' v0='<john>' in my code I calculate the value of the variable to output and if I echo it, I... (2 Replies)
Discussion started by: say170
2 Replies

9. Shell Programming and Scripting

Printing array elements in reverse

Hello Experts, I am trying to print an array in reverse. Input : 1. Number of array elements 2. The array. Eg: 4 1 2 3 4 Expected Output (elements separated by a space) : 4 3 2 1 My Code : (6 Replies)
Discussion started by: H squared
6 Replies

10. Shell Programming and Scripting

Array not printing values if used in a loop

Hello! I'm making an English to Morse Code translator and I was able to mostly get it all working by looking through older posts here; however, I have one small problem. When I run it it's just printing spaces for where the characters should be. It runs the right amount of times, and if I try... (3 Replies)
Discussion started by: arcoleman10
3 Replies
HTML::Lint(3pm) 					User Contributed Perl Documentation					   HTML::Lint(3pm)

NAME
HTML::Lint - check for HTML errors in a string or file VERSION
Version 2.20 SYNOPSIS
my $lint = HTML::Lint->new; $lint->only_types( HTML::Lint::Error::STRUCTURE ); $lint->parse( $data ); $lint->parse_file( $filename ); my $error_count = $lint->errors; foreach my $error ( $lint->errors ) { print $error->as_string, " "; } HTML::Lint also comes with a wrapper program called weblint that handles linting from the command line: $ weblint http://www.cnn.com/ http://www.cnn.com/ (395:83) <IMG SRC="spacer.gif"> tag has no HEIGHT and WIDTH attributes. http://www.cnn.com/ (395:83) <IMG SRC="goofus.gif"> does not have ALT text defined http://www.cnn.com/ (396:217) Unknown element <nobr> http://www.cnn.com/ (396:241) </nobr> with no opening <nobr> http://www.cnn.com/ (842:7) target attribute in <a> is repeated And finally, you can also get Apache::HTML::Lint that passes any mod_perl-generated code through HTML::Lint and get it dumped into your Apache error_log. [Mon Jun 3 14:03:31 2002] [warn] /foo.pl (1:45) </p> with no opening <p> [Mon Jun 3 14:03:31 2002] [warn] /foo.pl (1:49) Unknown element <gronk> [Mon Jun 3 14:03:31 2002] [warn] /foo.pl (1:56) Unknown attribute "x" for tag <table> METHODS
NOTE: Some of these methods mirror HTML::Parser's methods, but HTML::Lint is not a subclass of HTML::Parser. new() Create an HTML::Lint object, which inherits from HTML::Parser. You may pass the types of errors you want to check for in the "only_types" parm. my $lint = HTML::Lint->new( only_types => HTML::Lint::Error::STRUCTURE ); If you want more than one, you must pass an arrayref: my $lint = HTML::Lint->new( only_types => [HTML::Lint::Error::STRUCTURE, HTML::Lint::Error::FLUFF] ); $lint->parser() Returns the parser object for this object, creating one if necessary. $lint->parse( $text ) $lint->parse( $code_ref ) Passes in a chunk of HTML to be linted, either as a piece of text, or a code reference. See HTML::Parser's "parse_file" method for details. $lint->parse_file( $file ) Analyzes HTML directly from a file. The $file argument can be a filename, an open file handle, or a reference to an open file handle. See HTML::Parser's "parse_file" method for details. $lint->eof Signals the end of a block of text getting passed in. This must be called to make sure that all parsing is complete before looking at errors. Any parameters (and there shouldn't be any) are passed through to HTML::Parser's eof() method. $lint->errors() In list context, "errors" returns all of the errors found in the parsed text. Each error is an object of the type HTML::Lint::Error. In scalar context, it returns the number of errors found. $lint->clear_errors() Clears the list of errors, in case you want to print and clear, print and clear. $lint->only_types( $type1[, $type2...] ) Specifies to only want errors of a certain type. $lint->only_types( HTML::Lint::Error::STRUCTURE ); Calling this without parameters makes the object return all possible errors. The error types are "STRUCTURE", "HELPER" and "FLUFF". See HTML::Lint::Error for details on these types. $lint->gripe( $errcode, [$key1=>$val1, ...] ) Adds an error message, in the form of an HTML::Lint::Error object, to the list of error messages for the current object. The file, line and column are automatically passed to the HTML::Lint::Error constructor, as well as whatever other key value pairs are passed. For example: $lint->gripe( 'attr-repeated', tag => $tag, attr => $attr ); Usually, the user of the object won't call this directly, but just in case, here you go. $lint->newfile( $filename ) Call "newfile()" whenever you switch to another file in a batch of linting. Otherwise, the object thinks everything is from the same file. Note that the list of errors is NOT cleared. Note that $filename does NOT need to match what's put into parse() or parse_file(). It can be a description, a URL, or whatever. MODIFYING HTML
::LINT'S BEHAVIOR Sometimes you'll have HTML that for some reason cannot conform to HTML::Lint's expectations. For those instances, you can use HTML comments to modify HTML::Lint's behavior. Say you have an image where for whatever reason you can't get dimensions for the image. This HTML snippet: <img src="logo.png" height="120" width="50" alt="Company logo"> <img src="that.png"> causes this error: foo.html (14:20) <img src="that.png"> tag has no HEIGHT and WIDTH attributes But if for some reason you can't get those dimensions when you build the page, you can at least stop HTML::Lint complaining about it. <img src="this.png" height="120" width="50" alt="Company logo"> <!-- html-lint elem-img-sizes-missing: off, elem-img-alt-missing: off --> <img src="that.png"> <!-- html-lint elem-img-sizes-missing: on, elem-img-alt-missing: off --> If you want to turn off all HTML::Lint warnings for a block of code, use <!-- html-lint all: off --> And turn them back on with <!-- html-lint all: off --> You don't have to use "on" and "off". For "on", you can use "true" or "1". For "off", you can use "0" or "false". For a list of possible errors and their codes, see HTML::Lint::Error, or run perldoc HTML::Lint::Error. BUGS, WISHES AND CORRESPONDENCE All bugs and requests are now being handled through GitHub. https://github.com/petdance/html-lint/issues DO NOT send bug reports to http://rt.cpan.org/ or http://code.google.com/ TODO
o Check for attributes that require values o <TABLE>s that have no rows. o Form fields that aren't in a FORM o Check for valid entities, and that they end with semicolons o DIVs with nothing in them. o HEIGHT= that have percents in them. o Check for goofy stuff like: <b><li></b><b>Hello Reader - Spanish Level 1 (K-3)</b> COPYRIGHT &; LICENSE Copyright 2005-2012 Andy Lester. This program is free software; you can redistribute it and/or modify it under the terms of the Artistic License v2.0. http://www.opensource.org/licenses/Artistic-2.0 Please note that these modules are not products of or supported by the employers of the various contributors to the code. AUTHOR
Andy Lester, andy at petdance.com perl v5.14.2 2012-04-06 HTML::Lint(3pm)
All times are GMT -4. The time now is 01:11 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy