Sponsored Content
Top Forums Shell Programming and Scripting How to print 1st field and last 2 fields together and the rest of the fields after it using awk? Post 302825743 by 100bees on Tuesday 25th of June 2013 05:29:05 AM
Old 06-25-2013
Thank you all for your valuable inputs it helped me.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Compare Tab Separated Field with AWK to all and print lines of unique fields.

Hi. I have a tab separated file that has a couple nearly identical lines. When doing: sort file | uniq > file.new It passes through the nearly identical lines because, well, they still are unique. a) I want to look only at field x for uniqueness and if the content in field x is the... (1 Reply)
Discussion started by: rocket_dog
1 Replies

2. Shell Programming and Scripting

awk - print all fields except for last field

How do I print all the fields of a record except for the $(NF) field? (4 Replies)
Discussion started by: locoroco
4 Replies

3. Shell Programming and Scripting

How to Print from nth field to mth fields using awk

Hi, Is there any short method to print from a particular field till another filed using awk? Example File: File1 ==== 1|2|acv|vbc|......|100|342 2|3|afg|nhj|.......|100|346 Expected output: File2 ==== acv|vbc|.....|100 afg|nhj|.....|100 (8 Replies)
Discussion started by: machomaddy
8 Replies

4. Shell Programming and Scripting

awk to split one field and print the last two fields within the split part.

Hello; I have a file consists of 4 columns separated by tab. The problem is the third fields. Some of the them are very long but can be split by the vertical bar "|". Also some of them do not contain the string "UniProt", but I could ignore it at this moment, and sort the file afterwards. Here is... (5 Replies)
Discussion started by: yifangt
5 Replies

5. Shell Programming and Scripting

awk - compare 1st 15 fields of record with 20 fields

I'm trying to compare 2 files for differences in a selct number of fields. When differnces are found it will write the whole record of the second file including appending '|C' out to a delta file. Each record will have 20 fields, but only want to do comparison of 1st 15 fields. The 1st field of... (7 Replies)
Discussion started by: sljnk
7 Replies

6. UNIX for Dummies Questions & Answers

Remove zeros from first field, but print all fields

Hello Everyone, I've got a comma-delimited file that looks like this: 0012,123 ,456 ,05/12/2014 0123,525 ,286 ,05/12/2014 0456,791 ,300 ,05/12/2014 1095,759 ,300 ,05/12/2014 1344,576 ,292 ,05/12/2014 1558,551 ,283 ,05/12/2014 002183719, , ... (9 Replies)
Discussion started by: Scottie1954
9 Replies

7. Shell Programming and Scripting

awk sort based on difference of fields and print all fields

Hi I have a file as below <field1> <field2> <field3> ... <field_num1> <field_num2> Trying to sort based on difference of <field_num1> and <field_num2> in desceding order and print all fields. I tried this and it doesn't sort on the difference field .. Appreciate your help. cat... (9 Replies)
Discussion started by: newstart
9 Replies

8. Shell Programming and Scripting

Print . in blank fields to prevent fields from shifting

The below code works great, kindly provided by @Don Cragun, the lines in bold print the current output. Since some of the fields printed can be blank some of the fields are shifted. I can not seem too add . to the blank fields like in the desired output. Basically, if there is nothing in the field... (10 Replies)
Discussion started by: cmccabe
10 Replies

9. Shell Programming and Scripting

awk to combine all matching fields in input but only print line with largest value in specific field

In the below I am trying to use awk to match all the $13 values in input, which is tab-delimited, that are in $1 of gene which is just a single column of text. However only the line with the greatest $9 value in input needs to be printed. So in the example below all the MECP2 and LTBP1... (0 Replies)
Discussion started by: cmccabe
0 Replies

10. Shell Programming and Scripting

awk to print lines based on text in field and value in two additional fields

In the awk below I am trying to print the entire line, along with the header row, if $2 is SNV or MNV or INDEL. If that condition is met or is true, and $3 is less than or equal to 0.05, then in $7 the sub pattern :GMAF= is found and the value after the = sign is checked. If that value is less than... (0 Replies)
Discussion started by: cmccabe
0 Replies
HTML::Form(3)						User Contributed Perl Documentation					     HTML::Form(3)

NAME
HTML::Form - Class that represents HTML forms SYNOPSIS
use HTML::Form; $form = HTML::Form->parse($html, $base_uri); $form->value(query => "Perl"); use LWP; LWP::UserAgent->new->request($form->click); DESCRIPTION
Objects of the "HTML::Form" class represents a single HTML <form> ... </form> instance. A form consist of a sequence of inputs that usu- ally have names, and which can take on various values. The following methods are available: $form = HTML::Form->new($method, $action_uri, [[$enctype], $input,...]) The constructor takes a $method and a $uri as argument. The $enctype and and initial inputs are optional. You will normally use HTML::Form->parse() to create new HTML::Form objects. @forms = HTML::Form->parse($html_document, $base_uri) The parse() class method will parse an HTML document and build up "HTML::Form" objects for each <form> found. If called in scalar con- text only returns the first <form>. Returns an empty list if there are no forms to be found. The $base_uri is (usually) the URI used to access the $html_document. It is needed to resolve relative action URIs. For LWP this parameter is obtained from the $response->base() method. $form->push_input($type, \%attr) Adds a new input to the form. $form->method( [$new] ) $form->action( [$new] ) $form->enctype( [$new] ) These method can be used to get/set the corresponding attribute of the form. $form->inputs This method returns the list of inputs in the form. $form->find_input($name, $type, $no) This method is used to locate some specific input within the form. At least one of the arguments must be defined. If no matching input is found, "undef" is returned. If $name is specified, then the input must have the indicated name. If $type is specified then the input must have the specified type. In addition to the types possible for <input> HTML tags, we also have "textarea" and "option". The $no is the sequence number of the input with the indicated $name and/or $type (where 1 is the first). $form->value($name, [$value]) The value() method can be used to get/set the value of some input. If no input have the indicated name, then this method will croak. $form->try_others(&callback) This method will iterate over all permutations of unvisited enumerated values (<select>, <radio>, <checkbox>) and invoke the callback for each. The callback is passed the $form as argument. $form->make_request Will return a HTTP::Request object that reflects the current setting of the form. You might want to use the click method instead. $form->click([$name], [$x, $y]) Will click on the first clickable input ("input/submit" or "input/image"), with the indicated $name, if specified. You can optinally specify a coordinate clicked, which only makes a difference if you clicked on an image. The default coordinate is (1,1). $form->form Returns the current setting as a sequence of key/value pairs. $form->dump Returns a textual representation of the form. Mainly useful for debugging. If called in void context, then the dump is printed on STDERR. INPUTS
An "HTML::Form" contains a sequence of inputs. References to the inputs can be obtained with the $form->inputs or $form->find_input meth- ods. Once you have such a reference, then one of the following methods can be used on it: $input->type Returns the type of this input. Types are stuff like "text", "password", "hidden", "textarea", "image", "submit", "radio", "checkbox", "option"... $input->name([$new]) $input->value([$new]) These methods can be used to set/get the current name or value of an input. If the input only can take an enumerated list of values, then it is an error to try to set it to something else and the method will croak if you try. $input->possible_values Returns a list of all values that and input can take. For inputs that does not have discrete values this returns an empty list. $input->other_possible_values Returns a list of all values not tried yet. $input->form_name_value Returns a (possible empty) list of key/value pairs that should be incorporated in the form value from this input. $input->click($form, $x, $y) Some input types (currently "sumbit" buttons and "images") can be clicked to submit the form. The click() method returns the corrsponding "HTTP::Request" object. SEE ALSO
LWP, HTML::Parser, webchatpp COPYRIGHT
Copyright 1998-2000 Gisle Aas. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. libwww-perl-5.65 2001-08-01 HTML::Form(3)
All times are GMT -4. The time now is 03:01 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy