Sponsored Content
Top Forums Shell Programming and Scripting merging of 2 files AWK, SHELL or something else Post 302159680 by radoulov on Friday 18th of January 2008 07:28:42 AM
Old 01-18-2008
But we have another problem here: the primary key ($1,$7)
is not unique in managed_event_log.170108:
12,KAZUAT1 for both records. We have to add another element
(field?) to the key, it has to be unique. Which part of $8 can be considered ("TOO MANY PROCESSES", "NOT EXIST" or something
else)?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Merging files with AWK filtering and counting lines

Hi there, I have a couple of files I need to merge. I can do a simple merge by concatenating them into one larger file. But then I need to filter the file to get a desired result. The output looks like this: TRNH 0000000010941 ORDH OADR OADR ORDL ENDT 1116399 000000003... (2 Replies)
Discussion started by: Meert
2 Replies

2. Shell Programming and Scripting

merging of 2 files AWK - part 2

i have try , but i think i will never learn awk :( now i have 2 files : a 1:aaa:2:aaa1 2:bbb:2:bbb1 3:ccc:3:ccc1 b aaa:2 bbb:0 ccc:3 output: for all lines where a.$2 == b.$1 i want to compare a.$3 != b.$2 if true then set err=1 if false set err=0 and print all lines from file a +... (2 Replies)
Discussion started by: pp56825
2 Replies

3. Shell Programming and Scripting

awk merging files based on 2 complex conditions

1. if the 1st row IDs of input1 (ID1/ID2.....) is equal to any IDNames of input2 print all relevant values together as defined in the output. 2. A bit tricky part is IDno in the output. All we need to do is numbering same kind of letters as 1 (aa of ID1) and different letters as 2 (ab... (4 Replies)
Discussion started by: ruby_sgp
4 Replies

4. Shell Programming and Scripting

awk command : row by row merging of two files

I want to write a scrpit to merge files row wise (actually concatinating) main.txt X Y Z file 1 A B C file 2 1 2 3 now i want the script to check if the file1 is empty or not, if empty then make it like A B C 1 2 3 again to check if second file is empty if not do as done... (0 Replies)
Discussion started by: shashi792
0 Replies

5. Shell Programming and Scripting

AWK Script For Merging Text Files

Hello, I am trying to merge data from two text files. One file (File1) contains a listing of data which includes the trial number in Column 5, while the other text file (File2) contains what category the trial belongs to. Here is a snippet of what File1 looks like. 1 Arrow_ST 9.738 0.905... (2 Replies)
Discussion started by: Jahn
2 Replies

6. Shell Programming and Scripting

merging files using awk

Hi, I have 2 files. File 1 chr1 1234 2468 ABC chr1 3456 4567 DEF chr2 5643 6154 XYZ : : : : so on.... File 2 chr1 1500 2500 positive chr1 2500 3500 negative chr1 3000 4500 neutral (10 Replies)
Discussion started by: Diya123
10 Replies

7. Shell Programming and Scripting

Merging two files in awk

Hi, How I can merge two file columns such as the followings using awk: file 1 2 3 2 2 1 1 file 2 4 3 4 5 7 6 Result: 2 3 4 3 2 2 4 5 1 1 7 6 This is an example, at the end, I will have about 25 files that I want to merge them, it is important for me that the order in the... (7 Replies)
Discussion started by: Homa
7 Replies

8. Shell Programming and Scripting

Merging rows in awk

Hello, I have a data format as follows: Ind1 0 1 2 Ind1 0 2 1 Ind2 1 1 0 Ind2 2 2 0 I want to use AWK to have this output: Ind1 00 12 21 Ind2 12 12 00 That is to merge each two rows with the same row names. Thank you very much in advance for your help. (8 Replies)
Discussion started by: Homa
8 Replies

9. Shell Programming and Scripting

Merging Files in UNIX shell script

I have the urge to merge some files using unix shell script but I'm very new using this language and I haven't succeeded yet. The requirement is to merge the header, body and footer into one file with the name "ANY-NAME" in below example. To identify which files should be merged, I have flagged... (9 Replies)
Discussion started by: black_soul
9 Replies

10. Shell Programming and Scripting

awk Merging multiple files with symbol representing new file

I just tried following ls *.dat|sort -t"_" -k2n,2|while read f1 && read f2; do awk '{print}' $f1 awk FNR==1'{print $1,$2,$3,$4,$5,"*","*","*" }' OFS="\t" $f2 awk '{print}' $f2 donegot following result 18-Dec-1983 11:45:00 AM 18.692 84.672 0 25.4 24 18-Dec-1983 ... (3 Replies)
Discussion started by: Akshay Hegde
3 Replies
ns_set(3aolserver)					    AOLserver Built-In Commands 					ns_set(3aolserver)

__________________________________________________________________________________________________________________________________________________

NAME
ns_set - commands SYNOPSIS
Manipulate sets of key-value pairs. SYNTAX
ns_set copy ?-persist? setId ns_set cput setId key value ns_set create ?-persist? name ns_set delete setId fieldNumber ns_set delkey setId key ns_set find setId key ns_set free setId ns_set get setId key ns_set icput setId key value ns_set idelkey setId key ns_set ifind setId key ns_set iget setId key ns_set isnull setId fieldNumber ns_set iunique setId key ns_set key setId fieldNumber ns_set merge high low ns_set move to from ns_set name setId ns_set new ?-persist? name ns_set print setId ns_set put setId key value ns_set size setId ns_set split ?-persist? setId ?splitChar? ns_set truncate setId size ns_set unique setId key ns_set update setId key value ns_set value setId fieldNumber _________________________________________________________________ DESCRIPTION
ns_set copy Returns a new set that has the same name and key value pairs as the passed-in set (setId). If -persist is specified, the new set will persist even after the current transaction ends, and you can free it later with ns_set free. If -persist is not specified, the new set is automatically freed when the transaction ends. ns_set cput appends a new field to the set with key key and value value if the field does not already exist in the set. The field number of the new field is returned. ns_set create (which is the same as ns_set new) allocates memory for a new set and returns the ID for the new set. If -persist is specified, the new set will persist even after the current transaction ends, and you can free it later with ns_set free. If -persist is not speci- fied, the new set is automatically freed when the transaction ends. ns_set delete deletes the field in the set at field number fieldNumber. ns_set delkey removes the first field in the set whose key is key. Note that there could be multiple fields in the set with this key; this command only removes the first occurrence. ns_set find returns the index of the first field in the specified set whose key name matches the specified key. Zero(0) is the index of the first field. If no matching fields are found, ns_set find returns -1. ns_set free frees the specified set. Sets must be explicitly freed with ns_set free if the -persist option was used when creating the set. Oth- erwise, sets are automatically freed when the transaction ends. ns_set get returns the first value associated with the passed-in key. If the key is invalid, an empty string is returned. ns_set icput is the case-insensitive counterpart of ns_set cput. ns_set idelkey is the case-insensitive counterpart of ns_set delkey. ns_set ifind is the case-insensitive counterpart of ns_set find. ns_set iget is the case-insensitive counterpart of ns_set get. ns_set isnull returns 1 if the value of the field specified by fieldNumber is null and 0 if it is not. Note that an empty string is not the same as a null. ns_set isnull will return 0 for an empty string. ns_set iunique returns 1 if the specified key is unique in the specified set and 0 if it is not. The test for uniqueness is performed case-insensi- tively. ns_set unique is the case-sensitive version of this function. For example, a client could send multiple "Accept:" headers which would end up in the header set for the connection. ns_set iunique would return 0 for the "Accept:" key, because there are multiple fields with the key "Accept:". ns_set key extracts the key of the set at field number fieldNumber. This command is useful when looping through all the key-value pairs in the set. ns_set merge merges two sets. Any fields in the low set are appended to the high set if a field with the same key name does not already exist in the high set. ns_set move moves all fields from the from set to the end of the to set, leaving the from set a valid, empty set. ns_set name returns the name of the set. ns_set new (which is the same as ns_set create) allocates memory for a new set and returns the ID for the new set. If -persist is specified, the new set will persist even after the current transaction ends, and you can free it later with ns_set free. If -persist is not specified, the new set is automatically freed when the transaction ends. ns_set print prints the specified set to stderr. ns_set put appends a new field to the set with key key and value value. Note that the field is appended so if a previous field has the same key as the new field, the previous field is returned by ns_set get command. The field number of the new field is returned. ns_set size returns the number of key-value pairs in the set. ns_set split splits one set into multiple sets based on the splitChar as described below and returns a Tcl list of the newly-allocated sets. It assumes that the keys in the specified set (setId) contain a specific character (splitChar) that can be used to separate the name of a new set and the key in the new set. The default splitChar is a period (.). For example, if two fields in the original set have "dog.food" and "cat.food" as their key names and "Yummy dog food!" and "Yummy cat food!" as their values, ns_set split would return two new sets named "dog" and "cat". The dog set would have a single field whose key is "food" and whose value is "Yummy dog food!". The cat set would have a single field whose key is "food" and whose value is "Yummy cat food!". ns_set truncate reduces the set to the first size key-value pairs and frees the memory for the rest of the key-value pairs that may have been in the set. ns_set unique returns 1 if the specified key is unique in the specified set and 0 if it is not. The test for uniqueness is performed case-sensi- tively. ns_set iunique is the case-insensitive version of this function. ns_set update updates the first field in the specified set whose key is key and replaces its value with value. ns_set update is equivalent to ns_set delkey followed by ns_set put. ns_set value extracts the value of the set at field number fieldNumber. This command is useful when looping through all the key-value pairs in the set. NOTES
The fields in the set are ordered by number. The field numbers range from 0 to one less than the total number of fields. For example, if you have a set with 5 fields, you would use "ns_set key $setid 4" to extract the key of the last field in the set. KEYWORDS
key value AOLserver 4.0 ns_set(3aolserver)
All times are GMT -4. The time now is 02:43 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy