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
gd_eof(3)							      GETDATA								 gd_eof(3)

NAME
gd_eof -- report the number of samples in a dirfile field SYNOPSIS
#include <getdata.h> off_t gd_eof(DIRFILE *dirfile, const char *field_code); DESCRIPTION
The gd_eof() function queries a dirfile(5) database specified by dirfile and returns the sample number of the end-of-field marker for the vector field given by field_code. This is effectively the total number of samples available for the field, including any frame offset. The caller should not assume that this is equivalent (when accounting for the samples-per-frame of the indicated field) to the number of frames in the database returned by gd_nframes(3), nor even that the end-of-field marker falls on a frame boundary. For a RAW field, the end-of-field marker occurs immediately after the last datum in the data file associated with the field. For other field types, the end-of-field marker is equivalent to the end-of-field marker closest to the start of the dirfile of any of the field in- puts. The special field INDEX has no end-of-field marker. The end-of-field marker for a field containing no data is in the same location as, or before, its beginning-of-field marker (see gd_bof(3)). For a RAW field, the difference between the locations of the beginning- and end-of-field markers indicates the number of sam- ples of data actually stored on disk. The dirfile argument must point to a valid DIRFILE object previously created by a call to gd_open(3). RETURN VALUE
Upon successful completion, gd_eof() returns the sample number of the end-of-field marker for the indicated field. On error, it returns -1 and sets the dirfile error to a non-zero error value. Possible error values are: GD_E_BAD_CODE The field specified by field_code or one of the fields it uses as input was not found in the database. GD_E_BAD_DIRFILE The supplied dirfile was invalid. GD_E_BAD_FIELD_TYPE The location of the non-existent end-of-field marker for the special field INDEX was requested, possibly as a result of the field specified by field_code using INDEX as one of its inputs. GD_E_BAD_REPR The representation suffix specified in field_code, or in one of its inputs was not recognised. GD_E_DIMENSION A scalar field was found where a vector field was expected in the definition of field_code or one of its inputs, or else field_code itself specified a scalar field. GD_E_RAW_IO An attempt to stat(2) the file associated with the field, or one of its input fields, failed. GD_E_RECURSE_LEVEL Too many levels of recursion were encountered while trying to resolve field_code. This usually indicates a circular dependency in field specification in the dirfile. GD_E_UNKNOWN_ENCODING The size of the decoded data file associated with the specified field or one of its inputs could not be determined, because its en- coding scheme was not understood. GD_E_UNSUPPORTED The size of the decoded data file associated with the specified field or one of its inputs could not be determined, because its en- coding scheme was not supported. The dirfile error may be retrieved by calling gd_error(3). A descriptive error string for the last error encountered can be obtained from a call to gd_error_string(3). SEE ALSO
dirfile(5), dirfile-encoding(5), gd_open(3), gd_bof(3), gd_error(3), gd_error_string(3), gd_nframes(3) Version 0.7.0 15 October 2010 gd_eof(3)
All times are GMT -4. The time now is 11:19 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy