Is it always a fixed number of columns in each file? If so, you could use cut:-
Robin
Hello rbatte1,
Thank you for your nice code sir, may I add here my humble view here(hope I am correct here, kindly correct me if I am wrong here).
I think if we need to print last 100 columns then final line in above code could be following.
I haven't tested it though.
Hi All,
I have a table with 10 columns. Some columns(2nd,4th,5th,7th,8th and 10th) are Not Null columns. I'll get a tab-delimited file and want to check col by col and generate seperate error code for each col eg:102 if 2nd col value is NULL and 104 if 4th col value is NULL so on... I am a... (7 Replies)
ex:
a file has :
122323
123456456
125656879
678989965t635
234323432
b has :
this is finance no.
this is phone no
this is extn
ajkdgag
idjsidj
i want the o/p as:
122323 his is finance no.
123456456 this is phone no
123456456 ... (4 Replies)
Hi,
We have a requirement of calculating the AVG, Peak and 2nd Peak (Say Peak2) of a column in a text file. We are able to get Avg and Peak but we are finding difficulty in getting the 2nd Peak. I tried using the AWK but in vainL. Please find the below Script i have written for fetching AVG and... (3 Replies)
Hello everyone,
I searched the forum looking for answers to this but I could not pinpoint exactly what I need as I keep having trouble.
I have many files each having two columns and hundreds of rows.
first column is a string (can have many words) and the second column is a number.The files are... (5 Replies)
Hi,
i have below list of files so i just want the name of the files in one parameter and not the timestamp.
i want only GIDW_Dy_Tm_Seg_Sls_legacy_PL_0_0_ in variable of all files.
GIDW_Dy_Tm_Seg_Sls_legacy_PL_0_0_20131001101800.csv
GIDW_Dly_Sls_legacy_RO_0_0_20131001172001.csv
... (9 Replies)
input.csv:
Field1,Field2,Field3,Field4,Field4
abc ,123 ,xyz ,000 ,pqr
mno ,123 ,dfr ,111 ,bbb
output:
Field2,Field4
123 ,000
123 ,111
how to fetch the values of Field4 where Field2='123'
I don't want to fetch the values based on column position. Instead want to... (10 Replies)
I have the code for the below things..
File1 has the content as below
8859 0 subscriberCreate
18 0 subscriberPaymentMethodChange
1650 0 subscriberProfileUpdate
7668 0 subscriberStatusChange
13 4020100 subscriberProfileUpdate
1 4020129 subscriberStatusChange
2 4020307 subscriberCreate
8831... (5 Replies)
I have file that looks like this,
DIP-17571N|refseq:NP_651151 DIP-17460N|refseq:NP_511165|uniprotkb:P45890 DIP-17571N|refseq:NP_651151
DIP-19241N|refseq:NP_524261 DIP-19241N|refseq:NP_524261 DIP-17151N|refseq:NP_524316|uniprotkb:O16797
DIP-19588N|refseq:NP_731165 ... (2 Replies)
Hi Experts,
Please bear with me, i need help
I am learning AWk and stuck up in one issue.
First point : I want to sum up column value for column 7, 9, 11,13 and column15 if rows in column 5 are duplicates.No action to be taken for rows where value in column 5 is unique.
Second point : For... (1 Reply)
hi
I have 2 file with more than 10 columns for both
1st file
apple,0,0,0......
orange,1,2,3.....
mango,2,4,5.....
2nd file
apple,2,3,4,5,6,7...
orange,2,3,4,5,6,8...
watermerlon,2,3,4,5,6,abc...
mango,5,6,7,4,6,def.... (1 Reply)
Discussion started by: tententen
1 Replies
LEARN ABOUT DEBIAN
rtbl_add_column_entry
RTBL(3) BSD Library Functions Manual RTBL(3)NAME
rtbl_create, rtbl_destroy, rtbl_set_flags, rtbl_get_flags, rtbl_set_prefix, rtbl_set_separator, rtbl_set_column_prefix,
rtbl_set_column_affix_by_id, rtbl_add_column, rtbl_add_column_by_id, rtbl_add_column_entry, rtbl_add_column_entry_by_id, rtbl_new_row,
rtbl_format -- format data in simple tables
LIBRARY
The roken library (libroken, -lroken)
SYNOPSIS
#include <rtbl.h>
int
rtbl_add_column(rtbl_t table, const char *column_name, unsigned int flags);
int
rtbl_add_column_by_id(rtbl_t table, unsigned int column_id, const char *column_header, unsigned int flags);
int
rtbl_add_column_entry(rtbl_t table, const char *column_name, const char *cell_entry);
int
rtbl_add_column_entry_by_id(rtbl_t table, unsigned int column_id, const char *cell_entry);
rtbl_t
rtbl_create(void);
void
rtbl_destroy(rtbl_t table);
int
rtbl_new_row(rtbl_t table);
int
rtbl_set_column_affix_by_id(rtbl_t table, unsigned int column_id, const, char, *prefix", const char *suffix);
int
rtbl_set_column_prefix(rtbl_t table, const char *column_name, const char *prefix);
unsigned int
rtbl_get_flags(rtbl_t table);
void
rtbl_set_flags(rtbl_t table, unsigned int flags);
int
rtbl_set_prefix(rtbl_t table, const char *prefix);
int
rtbl_set_separator(rtbl_t table, const char *separator);
int
rtbl_format(rtbl_t table, FILE, *file");
DESCRIPTION
This set of functions assemble a simple table consisting of rows and columns, allowing it to be printed with certain options. Typical use
would be output from tools such as ls(1) or netstat(1), where you have a fixed number of columns, but don't know the column widths before
hand.
A table is created with rtbl_create() and destroyed with rtbl_destroy().
Global flags on the table are set with rtbl_set_flags and retrieved with rtbl_get_flags. At present the only defined flag is
RTBL_HEADER_STYLE_NONE which suppresses printing the header.
Before adding data to the table, one or more columns need to be created. This would normally be done with rtbl_add_column_by_id(), column_id
is any number of your choice (it's used only to identify columns), column_header is the header to print at the top of the column, and flags
are flags specific to this column. Currently the only defined flag is RTBL_ALIGN_RIGHT, aligning column entries to the right. Columns are
printed in the order they are added.
There's also a way to add columns by column name with rtbl_add_column(), but this is less flexible (you need unique header names), and is
considered deprecated.
To add data to a column you use rtbl_add_column_entry_by_id(), where the column_id is the same as when the column was added (adding data to a
non-existent column is undefined), and cell_entry is whatever string you wish to include in that cell. It should not include newlines. For
columns added with rtbl_add_column() you must use rtbl_add_column_entry() instead.
rtbl_new_row() fills all columns with blank entries until they all have the same number of rows.
Each column can have a separate prefix and suffix, set with rtbl_set_column_affix_by_id; rtbl_set_column_prefix allows setting the prefix
only by column name. In addition to this, columns may be separated by a string set with rtbl_set_separator (by default columns are not
seprated by anything).
The finished table is printed to file with rtbl_format.
EXAMPLES
This program:
#include <stdio.h>
#include <rtbl.h>
int
main(int argc, char **argv)
{
rtbl_t table;
table = rtbl_create();
rtbl_set_separator(table, " ");
rtbl_add_column_by_id(table, 0, "Column A", 0);
rtbl_add_column_by_id(table, 1, "Column B", RTBL_ALIGN_RIGHT);
rtbl_add_column_by_id(table, 2, "Column C", 0);
rtbl_add_column_entry_by_id(table, 0, "A-1");
rtbl_add_column_entry_by_id(table, 0, "A-2");
rtbl_add_column_entry_by_id(table, 0, "A-3");
rtbl_add_column_entry_by_id(table, 1, "B-1");
rtbl_add_column_entry_by_id(table, 2, "C-1");
rtbl_add_column_entry_by_id(table, 2, "C-2");
rtbl_add_column_entry_by_id(table, 1, "B-2");
rtbl_add_column_entry_by_id(table, 1, "B-3");
rtbl_add_column_entry_by_id(table, 2, "C-3");
rtbl_add_column_entry_by_id(table, 0, "A-4");
rtbl_new_row(table);
rtbl_add_column_entry_by_id(table, 1, "B-4");
rtbl_new_row(table);
rtbl_add_column_entry_by_id(table, 2, "C-4");
rtbl_new_row(table);
rtbl_format(table, stdout);
rtbl_destroy(table);
return 0;
}
will output the following:
Column A Column B Column C
A-1 B-1 C-1
A-2 B-2 C-2
A-3 B-3 C-3
A-4
B-4
C-4
HEIMDAL June 26, 2004 HEIMDAL