Sponsored Content
Top Forums Shell Programming and Scripting Look up 2 files and print the concatenated output Post 302781967 by panyam on Monday 18th of March 2013 06:46:59 AM
Old 03-18-2013
Not sure, but your solution did not work for me. The below one is working ok for me.


Code:
$ cat f1
Sun Mar 17 00:01:33 2013 submit , Name="1234"
Sun Mar 17 00:01:33 2013 submit , Name="1344"
Sun Mar 17 00:01:33 2013 submit , Name="1124"

$ cat f2
Sun Mar 17 00:02:47 2013 1234 execute SUCCEEDED
Sun Mar 17 00:02:48 2013 1344 execute FAILED
Sun Mar 17 00:02:48 2013 1124 execute SUCCEEDED
Sun Mar 17 00:02:49 2013 1222 execute SUCCEEDED
Sun Mar 17 00:02:49 2013 1111 execute SUCCEEDED
Sun Mar 17 00:02:50 2013 1211 execute SUCCEEDED
Sun Mar 17 00:02:50 2013 1111 execute SUCCEEDED
Sun Mar 17 00:02:51 2013 8901 execute FAILED


$ awk 'BEGIN { FS="[=\t\" ]+" } NR==FNR{a[$6]=$7" "$8;next} {if($9 in a) {print $0" "a[$9]}}' f2 f1
Sun Mar 17 00:01:33 2013 submit , Name="1234"  execute SUCCEEDED
Sun Mar 17 00:01:33 2013 submit , Name="1344"  execute FAILED
Sun Mar 17 00:01:33 2013 submit , Name="1124"  execute SUCCEEDED

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk to compare lines of two files and print output on screen

hey guys, I have two files both with two columns, I have already created an awk code to ignore certain lines (e.g lines that start with 963) as they wou ld begin with a certain string, however, the rest I have added together and calculated the average. At the moment the code also displays... (3 Replies)
Discussion started by: chlfc
3 Replies

2. Shell Programming and Scripting

compare columns from seven files and print the output

Hi guys, I need some help to come out with a solution . I have seven such files but I am showing only three for convenience. filea a5 20 a8 16 fileb a3 42 a7 14 filec a5 23 a3 07 The output file shoud contain the data in table form showing first field of... (7 Replies)
Discussion started by: smriti_shridhar
7 Replies

3. Shell Programming and Scripting

compare two files and search keyword and print output

You have two files to compare by searching keyword from one file into another file File A 23 >pp_ANSWER 24 >aa hello 25 >jau head wear 66 >jss oops 872 >aqq olps ploww oww sss 722 >GG_KILLER ..... large files File B Beta done KILLER John Mayor calix meyers ... (5 Replies)
Discussion started by: cdfd123
5 Replies

4. UNIX for Dummies Questions & Answers

Getting non unique lines from concatenated files

Hi All, Is there a way to get NON unique lines from 2 or more concatenated files? Basically I have several files which are very similar with the exception of few lines and I want to find out which lines are different in each file. Very simple example is file1 contains: 1 2 3 4 5file2... (122 Replies)
Discussion started by: pawannoel
122 Replies

5. Shell Programming and Scripting

match two key columns in two files and print output (awk)

I have two files... file1 and file2. Where columns 1 and 2 of file1 match columns 1 and 2 of file2 I want to create a new file that is all file1 + columns 3 and 4 of file2 :b: Many thanks if you know how to do this.... :b: file1 31-101 106 0 92 31-101 106 29 ... (2 Replies)
Discussion started by: pelhabuan
2 Replies

6. Shell Programming and Scripting

Print only lines where fields concatenated match strings

Hello everyone, Maybe somebody could help me with an awk script. I have this input (field separator is comma ","): 547894982,M|N|J,U|Q|P,98,101,0,1,1 234900027,M|N|J,U|Q|P,98,101,0,1,1 234900023,M|N|J,U|Q|P,98,54,3,1,1 234900028,M|H|J,S|Q|P,98,101,0,1,1 234900030,M|N|J,U|F|P,98,101,0,1,1... (2 Replies)
Discussion started by: Ophiuchus
2 Replies

7. Shell Programming and Scripting

Comparing 2 xml files and print the differences only in output

Hi....I'm having 2 xml files, one is having some special characters and another is a clean xml file does not have any special characters. Now I need one audit kind of file which will show me only from which line the special characters have been removed and the special characters. Can you please... (1 Reply)
Discussion started by: Krishanu Saha
1 Replies

8. Shell Programming and Scripting

Match two columns from two files and print output

Hello, I have two files which are of the following format File 1 which has two columns Protein_ID Substitution NP_997239 T53R NP_060668 V267M NP_058515 P856A NP_001206 T55M NP_006601 D371Y ... (2 Replies)
Discussion started by: nans
2 Replies

9. Shell Programming and Scripting

Awk: Print Error While Redirecting output in multiple Files

Hi, I have a following code in which I am unable to redirect to multiple files. Can anybody please help with some corrections awk -F, '{ if ( substr($1,26,2)=="02" && substr($1,184,14)=="MTSCC_VALFIRST") { array1++ array2++ array3++ } else if (substr($1,26,2)=="03" &&... (4 Replies)
Discussion started by: siramitsharma
4 Replies

10. UNIX for Beginners Questions & Answers

Compare two files and print output

Hi All, i am trying to compare two files in Centos 6. F1: /tmp/d21 NAME="xvda" TYPE="disk" SIZE="40G" OWNER="root" GROUP="disk" MODE="brw-rw----" MOUNTPOINT="" NAME="xvda1" TYPE="part" SIZE="500M" OWNER="root" GROUP="disk" MODE="brw-rw----" MOUNTPOINT="/boot" NAME="xvda2" TYPE="part"... (2 Replies)
Discussion started by: balu1234
2 Replies
ras2tiff(1)							   User Commands						       ras2tiff(1)

NAME
ras2tiff - create a TIFF file from a Sun rasterfile SYNOPSIS
ras2tiff [options] input.ras output.tif DESCRIPTION
ras2tiff converts a file in the Sun rasterfile format to TIFF. By default, the TIFF image is created with data samples packed (PlanarCon- figuration=1), compressed with the Lempel-Ziv and Welch algorithm (Compression=5), and with each strip no more than 8 kilobytes. These characteristics can be overridden or explicitly specified with the options described below. Any colormap information in the rasterfile is carried over to the TIFF file by including a Colormap tag in the output file. If the raster- file has a colormap, the PhotometricInterpretation tag is set to 3 (palette). Otherwise, the PhotometricInterpretation tag is set to 2 (RGB) if the depth is 24, or to 1 (min-is-black) if the depth is not 24. OPTIONS
The following options are supported: -c Specify a compression scheme to use when writing image data: -c jpeg Baseline JPEG compression algorithm. -c lzw Lempel-Ziv and Welch algorithm. This is the default algorithm. -c none No compression. -c packbits PackBits compression algorithm. -c zip Deflate compression algorithm. -r Write data with a specified number of rows per strip. By default, the number of rows per strip is selected so that each strip is approximately 8 kilobytes. OPERANDS
The following operands are supported: input.ras The name of the input file that contains Sun rasterfile data. output.tif The name of the output file that contains TIFF data. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWTiff | +-----------------------------+-----------------------------+ |Interface stability |External | +-----------------------------+-----------------------------+ SEE ALSO
pal2rgb(1), tiffinfo(1), tiffcp(1), tiffmedian(1), libtiff(3) NOTES
Does not support all possible rasterfiles. In particular, ras2tiff does not support run-length encoded images. Updated by Breda McColgan, Sun Microsystems Inc., 2004. SunOS 5.10 26 Mar 2004 ras2tiff(1)
All times are GMT -4. The time now is 12:40 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy