Sponsored Content
Top Forums Shell Programming and Scripting Filter (by max length) only lines not matching regex Post 302785153 by RudiC on Monday 25th of March 2013 02:59:32 AM
Old 03-25-2013
Do your data always come in pairs? If yes, your code is fine. Try also
Code:
$ while read HEAD; do read DATA; [ ${#DATA} -lt 10 ] && printf "%s\n%s\n" "$HEAD" "$DATA"; done < file
>gi|bcd| Species two
ATTTGATC
>gi|cdf| Species three
ATTTGATCT

This User Gave Thanks to RudiC For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Sed working on lines of small length and not large length

Hi , I have a peculiar case, where my sed command is working on a file which contains lines of small length. sed "s/XYZ:1/XYZ:3/g" abc.txt > xyz.txt when abc.txt contains lines of small length(currently around 80 chars) , this sed command is working fine. when abc.txt contains lines of... (3 Replies)
Discussion started by: thanuman
3 Replies

2. UNIX for Dummies Questions & Answers

Length of a Unix filepath max length

Hi Guys, Could anyone shed some light on the length of a Unix filepath max length pls ? thanks ! Wilson (3 Replies)
Discussion started by: wilsontan
3 Replies

3. Shell Programming and Scripting

Counting the max length of string

Hi all, I have a flat file of 1000 rows. I want to check the length of the 5th column. The one having the longest length , I want to set it as DEFINED PARAMETER. So later I can check others with that particular number only. Any ideas ?? (2 Replies)
Discussion started by: ganesh123
2 Replies

4. UNIX for Advanced & Expert Users

How to increase max username length?

Hi, This is my first post to this site. So kindly forgive if I am writing in a wrong section. My query is that... I want to modify the max username length size. I guess it is 32/64 on CentOS. Now I want to change it to 128. Is there any way to do that? Thanks in advance!! :) (4 Replies)
Discussion started by: ajay303
4 Replies

5. UNIX for Dummies Questions & Answers

Modify the max username length

Hey Any one... Do u know any way I can modify the max username length in unix? I guess it is 32/64 characters by default. Suppose I want to increase it to 128. i hav tried /etc/skel but no use... How can I do that? (2 Replies)
Discussion started by: MayureshRisbud
2 Replies

6. Shell Programming and Scripting

Perl Regex matching multiple lines

I need a way to extract data from X 4T Solution 21 OCT 2011 37 .00 to account 12345678 User1 user2 X 4T Solution Solution Unlimited 11 Sep 2009 248 .00 to account 87654321 user3 user4 I need it to extract 'X' '37.00' and account number 12345678. I have extracted above stuff... (3 Replies)
Discussion started by: chakrapani
3 Replies

7. Shell Programming and Scripting

Filter file by length, looking only at lines that don't begin with ">"

I have a file that stores data in pairs of lines, following this format: line 1: header (preceded by ">") line 2: sequence Example.txt: >seq1 name GATTGATGTTTGAGTTTTGGTTTTT >seq2 name TTTTCTTC I want to filter out the sequences and corresponding headers for all sequences that are less... (2 Replies)
Discussion started by: pathunkathunk
2 Replies

8. UNIX for Dummies Questions & Answers

awk loop for to filter lines by max value

Hi all, I'm struggling to filter my data frame. I need to print only those lines whose max value (the number of columns may vary) is above a cut-off value. My data looks like this: chr22 17565753 17565754 5 4 5 5 6 2 5 5 6 2 chr22 17565754 ... (2 Replies)
Discussion started by: lsantome
2 Replies

9. Shell Programming and Scripting

Filter all the lines with minimum specified length of words of a text file

Hi Can someone tell me which script will work best (in terms of speed and simplicity to write and run) for a large text file to filter all the lines with a minimum specified length of words ? A sample script with be definitely of great help !!! Thanks in advance. :) (4 Replies)
Discussion started by: my_Perl
4 Replies

10. Shell Programming and Scripting

Filter Row Based On Max Column Value After Group BY

Hello Team, Need your expertise on following: Here is the set of data: C1|4|C1SP1|A1|C1BP1|T1 C1|4|C1SP2|A1|C1BP2|T2 C2|3|C2SP1|A2|C2BP1|T2 C3|3|C3SP1|A3|C3BP1|T2 C2|2|C2SP2|A2|C2BP2|T1 I need to filter above date base on following two steps: 1. Group them by column 1 and 4 2.... (12 Replies)
Discussion started by: angshuman
12 Replies
XML::Grove::Factory(3pm)				User Contributed Perl Documentation				  XML::Grove::Factory(3pm)

NAME
XML::Grove::Factory - simplify creation of XML::Grove objects SYNOPSIS
use XML::Grove::Factory; ### An object that creates Grove objects directly my $gf = XML::Grove::Factory->grove_factory; $grove = $gf->document( CONTENTS ); $element = $gf->element( $name, { ATTRIBUTES }, CONTENTS ); $pi = $gf->pi( $target, $data ); $comment = $gf->comment( $data ); ### An object that creates elements by method name my $ef = XML::Grove::Factory->element_factory(); $element = $ef->NAME( { ATTRIBUTES }, CONTENTS); ### Similar to `element_factory', but creates functions in the ### current package XML::Grove::Factory->element_functions( PREFIX, ELEMENTS ); $element = NAME( { ATTRIBUTES }, CONTENTS ); DESCRIPTION
"XML::Grove::Factory" provides objects or defines functions that let you simply and quickly create the most commonly used XML::Grove objects. "XML::Grove::Factory" supports three types of object creation. The first type is to create raw XML::Grove objects. The second type creates XML elements by element name. The third type is like the second, but defines local functions for you to call instead of using an object, which might save typing in some cases. The three types of factories can be mixed. For example, you can use local functions for all element names that don't conflict with your own sub names or contain special characters, and then use a `"grove_factory()"' object for those elements that do conflict. In the examples that follow, each example is creating an XML instance similar to the following, assuming it's pretty printed: <?xml version="1.0"?> <HTML> <HEAD> <TITLE>Some Title</TITLE> </HEAD> <BODY bgcolor="#FFFFFF"> <P>A paragraph.</P> </BODY> </HTML> GROVE FACTORY
$gf = XML::Grove::Factory->grove_factory() Creates a new grove factory object that creates raw XML::Grove objects. $gf->document( CONTENTS ); Creates an XML::Grove::Document object. CONTENTS may contain processing instructions, strings containing only whitespace characters, and a single element object (but note that there is no checking). Strings are converted to XML::Grove::Characters objects. $gf->element($name, CONTENTS); $gf->element($name, { ATTRIBUTES }, CONTENTS); Creates an XML::Grove::Element object with the name `$name'. If the argument following `$name' is an anonymous hash, ATTRIBUTES, then they will be copied to the elements attributes. CONTENTS will be stored in the element's content (note that there is no validity checking). Strings in CONTENTS are converted to XML::Grove::Characters objects. $gf->pi( TARGET, DATA) $gf->pi( DATA ) Create an XML::Grove::PI object with TARGET and DATA. $gf->comment( DATA ) Create an XML::Grove::Comment object with DATA. GROVE FACTORY EXAMPLE use XML::Grove::Factory; $gf = XML::Grove::Factory->grove_factory; $element = $gf->element('HTML', $gf->element('HEAD', $gf->element('TITLE', 'Some Title')), $gf->element('BODY', { bgcolor => '#FFFFFF' }, $gf->element('P', 'A paragraph.'))); ELEMENT FACTORY
$ef = XML::Grove::Factory->element_factory() Creates a new element factory object for creating elements. `"element_factory()"' objects work by creating an element for any name used to call the object. $ef->NAME( CONTENTS ) $ef->NAME( { ATTRIBUTES }, CONTENTS) Creates an XML::Grove::Element object with the given NAME, ATTRIBUTES, and CONTENTS. The hash containing ATTRIBUTES is optional if this element doesn't need attributes. Strings in CONTENTS are converted to XML::Grove::Characters objects. ELEMENT FACTORY EXAMPLE use XML::Grove::Factory; $ef = XML::Grove::Factory->element_factory(); $element = $ef->HTML( $ef->HEAD( $ef->TITLE('Some Title')), $ef->BODY({ bgcolor => '#FFFFFF' }, $ef->P('A paragraph.'))); ELEMENT FUNCTIONS
XML::Grove::Factory->element_functions (PREFIX, ELEMENTS) Creates functions in the current package for creating elements with the names provided in the list ELEMENTS. PREFIX will be prepended to every function name, or PREFIX can be an empty string ('') if you're confident that there won't be any conflicts with functions in your package. NAME( CONTENTS ) NAME( { ATTRIBUTES }, CONTENTS ) PREFIXNAME( CONTENTS ) PREFIXNAME( { ATTRIBUTES }, CONTENTS ) Functions created for `"NAME"' or `"PREFIXNAME"' can be called to create XML::Grove::Element objects with the given NAME, ATTRIBUTES, and CONTENT. The hash containing ATTRIBUTES is optional if this element doesn't need attributes. Strings in CONTENT are converted to XML::Grove::Characters objects. ELEMENT FACTORY EXAMPLE use XML::Grove::Factory; XML::Grove::Factory->element_functions('', qw{ HTML HEAD TITLE BODY P }); $element = HTML( HEAD( TITLE('Some Title')), BODY({ bgcolor => '#FFFFFF' }, P('A paragraph.'))); AUTHOR
Ken MacLeod, ken@bitsko.slc.ut.us Inspired by the HTML::AsSubs module by Gisle Aas. SEE ALSO
perl(1), XML::Grove(3). Extensible Markup Language (XML) <http://www.w3c.org/XML> perl v5.10.1 2010-01-29 XML::Grove::Factory(3pm)
All times are GMT -4. The time now is 10:23 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy