Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Multiple Column print after lookup using NR==FNR (awk) Post 302488510 by genehunter on Monday 17th of January 2011 12:49:22 PM
Old 01-17-2011
Hi Franklin52,

The script worked fine, it prints both the 1st and the second file. However, when it joins the first and second file, there is a character ^M in between that makes the second file to be printed on the next line in DOS.
I used the solution by anbu23 as mentioned in the previous post to solve it.

Code:
FAMID   IID     AFF     SEX     Group   AgeCat  Dis1      Dis2     Dis3      Dis4   Dis5  Dis6  Dis6 ^M   V1    V2    V3    V4    V5    V6    V7    V8    V9    V10 Status
AMD0001 Mayo_49542     1       2       AMD     8       1       1       1       1       1       1       1    ^M    -0.0053     -0.0046      0.0036     -0.0059      0.0019      0.0029      0.0022      0.0078      0.0043     -0.0001          Control
AMD0002 Mayo_49606     1       1       AMD     3       1       1       1       1       1       1       1    ^M    -0.0052     -0.0045      0.0035     -0.0022      0.0043     -0.0018      0.0072      0.0116     -0.0040     -0.0028          Control
AMD0003 Mayo_49702     1       2       AMD     3       1       1       1       1       1       1       1    ^M    -0.0045     -0.0041      0.0033      0.0016      0.0004     -0.0018     -0.0004      0.0003     -0.0021     -0.0041          Control
AMD0004 Mayo_49544     1       1       AMD     5       1       1       1       1       1       1       1    ^M    -0.0037     -0.0028      0.0036      0.0003     -0.0002     -0.0019      0.0035      0.0023      0.0077     -0.0005          Control
AMD0005 Mayo_49672     1       1       AMD     3       1       1       1       1       1       1       1    ^M    -0.0035     -0.0060      0.0008     -0.0029      0.0037      0.0011     -0.0212      0.0034      0.0024      0.0117          Control

~GH
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Awk: different between NR and FNR

As I know: FNR: The ordinal number of the current record in the current file. NR: The ordinal number of the current record from the start of input. I don't understand really differency between NR and FNR. Who can explain it for me? And give me an example. Thanks (1 Reply)
Discussion started by: anhtt
1 Replies

2. Shell Programming and Scripting

Multiple file lookup using awk

I want to lookup filea with fileb,filec and filed. If entry in filea exist in fileb and filec mark Y and then if entry in filea exist in filed mark as Y. Final output should have all the entries from filea. This prints only matching entries from file a in fileb i want all entries from... (9 Replies)
Discussion started by: pinnacle
9 Replies

3. Shell Programming and Scripting

find expression with awk in only one column, and if it fits, print whole column

Hi. How do I find an expression with awk in only one column, and if it fits, then print that whole column. 1 apple oranges 2 bannanas pears 3 cats dogs 4 hesaid shesaid echo "which number:" read NUMBER (user inputs number 2 for this example) awk " /$NUMBER/ {field to search is field... (2 Replies)
Discussion started by: glev2005
2 Replies

4. Shell Programming and Scripting

awk command to print only selected rows in a particular column specified by column name

Dear All, I have a data file input.csv like below. (Only five column shown here for example.) Data1,StepNo,Data2,Data3,Data4 2,1,3,4,5 3,1,5,6,7 3,2,4,5,6 5,3,5,5,6 From this I want the below output Data1,StepNo,Data2,Data3,Data4 2,1,3,4,5 3,1,5,6,7 where the second column... (4 Replies)
Discussion started by: ks_reddy
4 Replies

5. Shell Programming and Scripting

awk Print New Column For Every Two Lines and Match On Multiple Column Values to print another column

Hi, My input files is like this axis1 0 1 10 axis2 0 1 5 axis1 1 2 -4 axis2 2 3 -3 axis1 3 4 5 axis2 3 4 -1 axis1 4 5 -6 axis2 4 5 1 Now, these are my following tasks 1. Print a first column for every two rows that has the same value followed by a string. 2. Match on the... (3 Replies)
Discussion started by: jacobs.smith
3 Replies

6. Shell Programming and Scripting

Awk: print lines with one of multiple pattern in the same field (column)

Hi all, I am new to using awk and am quickly discovering what a powerful pattern-recognition tool it is. However, I have what seems like a fairly basic task that I just can't figure out how to perform in one line. I want awk to find and print all the lines in which one of multiple patterns (e.g.... (8 Replies)
Discussion started by: elgo4
8 Replies

7. Shell Programming and Scripting

Awk: Print count for column in a file using awk

Hi, I have the following input in a file & need output as mentioned below(need counter of every occurance of field which is to be increased by 1). Input: 919143110065 919143110065 919143110052 918648846132 919143110012 918648873782 919143110152 919143110152 919143110152... (2 Replies)
Discussion started by: siramitsharma
2 Replies

8. Shell Programming and Scripting

awk to print field from lookup file in output

The below awk uses $3 and $4 in search as the min and max, then takes each $2 value in lookup and compares it. If the value in lookupfalls within the range in searchthen it prints the entire line in lookup/ICODE]. What I can't seem to figure out is how to print the matching $5 from search on that... (4 Replies)
Discussion started by: cmccabe
4 Replies

9. Shell Programming and Scripting

awk to lookup stored variable in file and print matching line

The bash bash below extracts the oldest folder from a directory and stores it in filename That result will match a line in bold in input. In the matching line there is an_xxx digit in italics that (once the leading zero is removed) will match a line in link. That is the lint to print in output.... (2 Replies)
Discussion started by: cmccabe
2 Replies

10. Shell Programming and Scripting

Need awk or Shell script to compare Column-1 of two different CSV files and print if column-1 matche

Example: I have files in below format file 1: zxc,133,joe@example.com cst,222,xyz@example1.com File 2 Contains: hxd hcd jws zxc cst File 1 has 50000 lines and file 2 has around 30000 lines : Expected Output has to be : hxd hcd jws (5 Replies)
Discussion started by: TestPractice
5 Replies
AMDPM(4)						   BSD Kernel Interfaces Manual 						  AMDPM(4)

NAME
amdpm -- AMD 756/766/768/8111 Power Management controller driver SYNOPSIS
device smbus device smb device amdpm DESCRIPTION
This driver provides access to AMD 756/766/768/8111 Power management controllers. Currently, only the SMBus 1.0 controller function is implemented. The SMBus 2.0 functionality of the AMD 8111 controller is supported via the amdsmb(4) driver. The embedded SMBus controller of the AMD 756 chipset may give you access to the monitoring facilities of your mainboard. See smb(4) for writing user code to fetch voltages, temperature and so on from the monitoring chip of your mainboard. SEE ALSO
amdsmb(4), smb(4), smbus(4) HISTORY
The amdpm driver first appeared in FreeBSD 4.5. AUTHORS
This driver was written by Matthew C. Forman. Based heavily on the alpm driver by Nicolas Souchu. This manual page was written by Murray Stokely <murray@FreeBSD.org>. BUGS
Only polling mode is supported. BSD
December 31, 2005 BSD
All times are GMT -4. The time now is 01:32 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy