Sponsored Content
Top Forums Shell Programming and Scripting AWK Matching Fields and Combining Files Post 302302000 by Michelangelo on Sunday 29th of March 2009 05:59:02 PM
Old 03-29-2009
Bug Thank you! Thank you! Thank you!

Thank you very much for all the help. I'm a first-timer on the UNIX/LINUX forums, and definitely plan to come back when/if (okay, let's be honest - when) I need help again.

What fast replies, I was sure I'd have to wait until Monday for a response. I've tried all three of your suggestions and they all work beautifully!

Thank you again and enjoy your Sunday (or what's left of it)!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Matching and combining two files

Hi, How can I match the first two fields of file2 against the first two fields of file1 and where they match combine the two lines. If the name (example-Aidan Rielly) is in file1 but not in file2 then just write the info from file1 to the combined output file. If the name (example-Silvia... (5 Replies)
Discussion started by: p3t3r
5 Replies

2. Shell Programming and Scripting

combining fields in awk

I am using: ps -A -o command,%cpu to get process and cpu usage figures. I want to use awk to split up the columns it returns. If I use: awk '{print "Process: "$1"\nCPU Usage: "$NF"\n"}' the $NF will get me the value in the last column, but if there is more than one word in the... (2 Replies)
Discussion started by: json4639
2 Replies

3. Shell Programming and Scripting

Matching and combining two files

Hi there, I have two files. What I want to do is search for the values in second field of file1 in the 6th field of the file2 and of they match to add the fields 1-5 of the file2 at the end of the line of file1 with a comma before. E.g File1 FWB,CHUAGT87HUMAS/BUD01,REUAIR08KLM... (3 Replies)
Discussion started by: sickboy
3 Replies

4. Shell Programming and Scripting

To get an output by combining fields from two different files

Hi guys, I couldn't find solution to this problem. If anyone knows please help me out. your guidance is highly appretiated. I have two files - FILE1 has the following 7 columns ( - has been added to make columns visible enough else columns are separated by single space) 155.34 - leg - 1... (8 Replies)
Discussion started by: smriti_shridhar
8 Replies

5. Shell Programming and Scripting

AWK- delimiting the strings and matching the fields

Hello, I am newbie in awk. I have just started learning it. 1) I have input file which looks like: {4812 4009 1602 2756 306} {4814 4010 1603 2757 309} {8116 9362 10779 } {10779 10121 9193 10963 10908} {1602 2756 306 957 1025} {1603 2757 307} and so on..... 2) In output: a)... (10 Replies)
Discussion started by: kajolo
10 Replies

6. Shell Programming and Scripting

Awk: adding fields after matching $1

Dear AWK-experts! I did get stuck in the task of combining files after matching fields, so I'm still awkward with learning AWK. There are 2 files: one containing 3 columns with ID, coding status, and score for long noncoding RNAs: file1 (1.txt) (>5000 lines) ... (12 Replies)
Discussion started by: kben
12 Replies

7. UNIX for Beginners Questions & Answers

Awk: matching multiple fields between 2 files

Hi, I have 2 tab-delimited input files as follows. file1.tab: green A apple red B apple file2.tab: apple - A;Z Objective: Return $1 of file1 if, . $1 of file2 matches $3 of file1 and, . any single element (separated by ";") in $3 of file2 is present in $2 of file1 In order to... (3 Replies)
Discussion started by: beca123456
3 Replies

8. Shell Programming and Scripting

awk to print fields that match using conditions and a default value for non-matching in two files

Trying to use awk to match the contents of each line in file1 with $5 in file2. Both files are tab-delimited and there may be a space or special character in the name being matched in file2, for example in file1 the name is BRCA1 but in file2 the name is BRCA 1 or in file1 name is BCR but in file2... (6 Replies)
Discussion started by: cmccabe
6 Replies

9. UNIX for Beginners Questions & Answers

Continued trouble matching fields in different files and selective field printing ([g]awk)

I apologize in advance, but I continue to have trouble searching for matches between two files and then printing portions of each to output in awk and would very much appreciate some help. I have data as follows: File1 PS012,002 PRQ 0 1 1 17 1 0 -1 3 2 1 2 -1 ... (7 Replies)
Discussion started by: jvoot
7 Replies

10. UNIX for Beginners Questions & Answers

awk for matching fields between files with repeated records

Hello all, I am having trouble with what should be an easy task, but seem to be missing something fundamental. I have two files, with File 1 consisting of a single field of many thousands of records. I also have File 2 with two fields and many thousands of records. My goal is that when $1 of... (2 Replies)
Discussion started by: jvoot
2 Replies
getitimer(2)							System Calls Manual						      getitimer(2)

NAME
getitimer, setitimer - Returns or sets the value of interval timers SYNOPSIS
#include <sys/time.h> int getitimer( int which, struct itimerval *value) ; int setitimer( int which, const struct itimerval *value, struct itimerval *ovalue) ; The following definition of the setitimer() function does not conform to current standards and is supported only for backward compatibil- ity: int setitimer( int which, struct itimerval *value, struct itimerval *ovalue) ; STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: getitimer(), setitimer(): XSH4.2 Refer to the standards(5) reference page for more information about industry standards and associated tags. PARAMETERS
Identifies the interval timer. This parameter may be expressed as one of three symbolic constants: ITIMER_REAL, ITIMER_VIRTUAL, and ITIMER_PROF. Points to an itimerval structure whose members specify a timer interval and the time left to the end of the interval. Points to an itimerval structure whose members specify a current timer interval and the time left to the end of the interval. DESCRIPTION
The getitimer() function returns the current value for the timer specified by the which parameter in the structure pointed to by the value parameter. The setitimer() function sets the timer specified by which to the specified value (returning the previous value of the timer if ovalue is nonzero). A timer value is defined by the itimerval structure: struct itimerval { struct timeval it_interval; struct timeval it_value; }; If the it_value field is nonzero, it indicates the time to the next timer expiration. If the it_interval field is nonzero, it specifies a value to be used in reloading it_value when the timer expires. Setting it_value to 0 (zero) disables a timer. Setting it_interval to 0 causes a timer to be disabled after its next expiration (assuming it_value is nonzero). Time values smaller than the resolution of the system clock are rounded up to this resolution. The system provides each process with three interval timers, defined in the sys/time.h header file: Decrements in real time. A SIGALRM signal is delivered when this timer expires. Decrements in process virtual time. It runs only when the process is executing. A SIGVTALRM signal is delivered when it expires. Decrements both in process virtual time and when the system is running on behalf of the process. It is designed to be used by interpreters in statistically profiling the execution of interpreted programs. Each time the ITIMER_PROF timer expires, the SIGPROF signal is delivered. Because this signal may interrupt in-progress system calls, programs using this timer must be prepared to restart interrupted system calls. NOTES
The following information applies only to the backward-compatible versions of the getitimer() and setitimer() functions. Three macros for manipulating time values are defined in the sys/time.h header file. The timerclear() macro sets a time value to zero, the timerisset() macro tests if a time value is nonzero, and the timercmp() macro compares two time values. Beware that the comparisons >= and <= do not work with the timercmp() macro. RETURN VALUES
Upon successful completion, the value 0 (zero) is returned. Otherwise, -1 is returned and errno is set to indicate the error. ERRORS
The setitimer() function sets errno to the specified values for the following conditions: [Tru64 UNIX] The value parameter specified a bad address. The value parameter specified a time that was too large to be handled, or was a negative time value, or the which value is not defined. The getitimer() function sets errno to the specified values for the following conditions: [Tru64 UNIX] The value parameter specified a bad address. The which value is not defined. [Tru64 UNIX] The value parameter specified a time that was too large to be handled. RELATED INFORMATION
Functions: gettimeofday(2) Standards: standards(5) delim off getitimer(2)
All times are GMT -4. The time now is 03:10 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy