Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Normalize text field or sort values Post 303045958 by MadeInGermany on Monday 20th of April 2020 03:32:42 AM
Old 04-20-2020
1. Could you please clarify?
injest => ingest
normalize => sort ?

2. Could you provide a short example of your input data?

3. Could you provide your script trial?
If you run it on the example input data, would goes wrong?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to sort a field in a file having date values

Hi All, I am having a pipe delimited file .In this file the 3rd column is having date values.I need to get the min date and max date from that file. I have used cut -d '|' test.dat -f 3|sort -u But it is not sorting the date .How to sort the date column using unix commands Thanks ... (4 Replies)
Discussion started by: risshanth
4 Replies

2. Shell Programming and Scripting

Find top N values for field X based on field Y's value

I want to find the top N entries for a certain field based on the values of another field. For example if N=3, we want the 3 best values for each entry: Entry1 ||| 100 Entry1 ||| 95 Entry1 ||| 30 Entry1 ||| 80 Entry1 ||| 50 Entry2 ||| 40 Entry2 ||| 20 Entry2 ||| 10 Entry2 ||| 50... (1 Reply)
Discussion started by: FrancoisCN
1 Replies

3. Shell Programming and Scripting

Sort alpha on 1st field, numerical on 2nd field (sci notation)

I want to sort alphabetically on the first field and sort in descending numerical order on the 2nd field. With a normal "sort -r -n" it does this: abc ||| 5e-05 ||| bla abc ||| 3 ||| ble def ||| 1 ||| abc def ||| 0.2 ||| def As you can see it ignores the fact that 5e-05 is actually 0.00005... (1 Reply)
Discussion started by: FrancoisCN
1 Replies

4. Shell Programming and Scripting

adding field values if field matches

hi i have file as below , i want to add duplicate records like bell_bb to one record with valuve as 15 ( addition of both ) any oneline awk script to achive this ? header 0 CAMPAIGN_NAME 1 Bell_BB 14 Bell_MONTHLY 803 SOLO_UNBEATABLE 644 Bell_BB 1 Bell_MONTHLY 25 SOLO_UNBEATABLE... (4 Replies)
Discussion started by: raghavendra.cse
4 Replies

5. Shell Programming and Scripting

awk, comma as field separator and text inside double quotes as a field.

Hi, all I need to get fields in a line that are separated by commas, some of the fields are enclosed with double quotes, and they are supposed to be treated as a single field even if there are commas inside the quotes. sample input: for this line, 5 fields are supposed to be extracted, they... (8 Replies)
Discussion started by: kevintse
8 Replies

6. Shell Programming and Scripting

Awk Search text string in field, not all in field.

Hello, I am using awk to match text in a tab separated field and am able to do so when matching the exact word. My problem is that I would like to match any sequence of text in the tab-separated field without having to match it all. Any help will be appreciated. Please see the code below. awk... (3 Replies)
Discussion started by: rocket_dog
3 Replies

7. Shell Programming and Scripting

Read record from the text file contain multiple separated values & assign those values to variables

I have a file containing multiple values, some of them are pipe separated which are to be read as separate values and some of them are single value all are these need to store in variables. I need to read this file which is an input to my script Config.txt file name, first path, second... (7 Replies)
Discussion started by: ketanraut
7 Replies

8. Shell Programming and Scripting

Sort file by field 1 that has text as well as a number

I am using the below awk that results in the below output: awk '{k=$1 OFS $2; s+=$4; c++} END{for(i in s) print i, s/c}' input.txt > output.txt output.txt chr20:43625799-43625957 STK4:exon.6;STK4:exon.7 310.703 chr20:36770455-36770611 TGM2:exon.6;TGM2:exon.7 614.756... (5 Replies)
Discussion started by: cmccabe
5 Replies

9. Shell Programming and Scripting

awk to parse field and include the text of 1 pipe in field 4

I am trying to parse the input in awk to include the |gc= in $4 but am not able to. The below is close: awk so far: awk '{sub(/\|]+]++/, ""); print }' input.txt Input chr1 955543 955763 AGRN-6|pr=2|gc=75 0 + chr1 957571 957852 AGRN-7|pr=3|gc=61.2 0 + chr1 970621 ... (7 Replies)
Discussion started by: cmccabe
7 Replies

10. UNIX for Beginners Questions & Answers

awk GSUB read field values from multiple text files

My program run without error. The problem I am having. The program isn't outputting field values with the column headers to file.txt. Each of the column headers in file.txt has no data. MEMSIZE SECOND SASFoundation Filename The output results in file.txt should show: ... (1 Reply)
Discussion started by: dellanicholson
1 Replies
PROP_INGEST(3)						   BSD Library Functions Manual 					    PROP_INGEST(3)

NAME
prop_ingest_context_alloc, prop_ingest_context_free, prop_ingest_context_error, prop_ingest_context_type, prop_ingest_context_key, prop_ingest_context_private, prop_dictionary_ingest -- Ingest a dictionary into an arbitrary binary format SYNOPSIS
#include <prop/proplib.h> prop_ingest_context_t prop_ingest_context_alloc(void *private); void prop_ingest_context_free(prop_ingest_context_t ctx); prop_ingest_error_t prop_ingest_context_error(prop_ingest_context_t ctx); prop_type_t prop_ingest_context_type(prop_ingest_context_t ctx); const char * prop_ingest_context_key(prop_ingest_context_t ctx); void * prop_ingest_context_private(prop_ingest_context_t ctx); bool prop_dictionary_ingest(prop_dictionary_t dict, const prop_ingest_table_entry rules[], prop_ingest_context_t ctx); typedef bool (*prop_ingest_handler_t)(prop_ingest_context_t, prop_object_t); DESCRIPTION
The prop_dictionary_ingest function provides a convenient way to convert a property list into an arbitrary binary format or to extract values from dictionaries in a way that is convenient to an application (for configuration files, for example). prop_dictionary_ingest is driven by a table of rules provided by the application. Each rule consists of three items: o A C string containing a key to be looked up in the dictionary. o The expected property type of the object associated with the key (or PROP_TYPE_UNKNOWN to specify that any type is allowed). o A callback function of type prop_ingest_handler_t that will perform the translation for the application. The table is constructed using a series of macros as follows: static const prop_ingest_table_entry ingest_rules[] = { PROP_INGEST("file-name", PROP_TYPE_STRING, ingest_filename), PROP_INGEST("count", PROP_TYPE_NUMBER, ingest_count), PROP_INGEST_OPTIONAL("required", PROP_TYPE_BOOL, ingest_required), PROP_INGEST_OPTIONAL("extra", PROP_TYPE_UNKNOWN, ingest_extra), PROP_INGEST_END }; The PROP_INGEST macro specifies that the key is required to be present in the dictionary. The PROP_INGEST_OPTIONAL macro specifies that the presence of the key in the dictionary is optional. The PROP_INGEST_END macro marks the end of the rules table. In each case, prop_dictionary_ingest looks up the rule's key in the dictionary. If an object is present in the dictionary at that key, its type is checked against the type specified in the rule. A type specification of PROP_TYPE_UNKNOWN allows the object to be of any type. If the object does not exist and the rule is not marked as optional, then an error is returned. Otherwise, the handler specified in the rule is invoked with the ingest context and the object (or NULL if the key does not exist in the dictionary). The handler should return false if the value of the object is invalid to indicate failure and true otherwise. The ingest context contains several pieces of information that are useful during the ingest process. The context also provides specific error information should the ingest fail. prop_ingest_context_alloc(void *private) Allocate an ingest context. The argument private may be used to pass application-specific context to the ingest handlers. Note that an ingest context can be re-used to perform multiple ingests. Returns NULL on failure. prop_ingest_context_free(prop_ingest_context_t ctx) Free an ingest context. prop_ingest_context_error(prop_ingest_context_t ctx) Returns the code indicating the error encountered during ingest. The following error codes are defined: PROP_INGEST_ERROR_NO_ERROR No error was encountered during ingest. PROP_INGEST_ERROR_NO_KEY A non-optional key was not found in the dictionary. PROP_INGEST_ERROR_WRONG_TYPE An object in the dictionary was not the same type specified in the rules. PROP_INGEST_ERROR_HANDLER_FAILED An object's handler returned false. prop_ingest_context_type(prop_ingest_context_t ctx) Returns the type of the last object visited during an ingest. When called by an ingest handler, it returns the type of the object currently being processed. prop_ingest_context_key(prop_ingest_context_t ctx) Returns the last dictionary key looked up during an ingest. When called by an ingest handler, it returns the dictionary key corre- sponding to the object currently being processed. prop_ingest_context_private(prop_ingest_context_t ctx) Returns the private data set when the context was allocated with prop_ingest_context_alloc(). SEE ALSO
prop_dictionary(3), proplib(3) HISTORY
The proplib property container object library first appeared in NetBSD 4.0. BSD
January 21, 2008 BSD
All times are GMT -4. The time now is 10:44 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy