Sponsored Content
Top Forums Shell Programming and Scripting Plz Help. Compare 2 files field by field and get the output in another file. Post 302676867 by i150371485 on Wednesday 25th of July 2012 08:09:53 AM
Old 07-25-2012
@Chirel : Thank you so much Smilie Smilie it worked as expected. I have one doubt. if i use for some 50,000 records with 50 columns it is taking more time. is there any way we can reduce the timing and increase the performance ? Plz help ..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

AWK to compare two files for each field value

I have "n" files in directory A and "n" files in directory B. The files are expected to be the same with same data. Each file has 14 columns and "x" rows. Of the 14 column, 2 columns are to be considered as key identifiers. Based on this unique combination, I need to compare each field value... (2 Replies)
Discussion started by: Sangtha
2 Replies

2. UNIX and Linux Applications

How to compare 2 field from 2 separated file

I have a problem here. I'm trying to compare multiple fields. Files are like this: File 1: Email,Account Number,Contact,Status,Date File 2: Name|Address|Contact|Email|Account Number|0000000 #!/bin/bash myFolder=`pwd` TEMPFILE=$myFolder/tempfile APFILE=$myFolder/file 1.csv... (0 Replies)
Discussion started by: micxshinoda
0 Replies

3. Shell Programming and Scripting

AWK: Pattern match between 2 files, then compare a field in file1 as > or < field in file2

First, thanks for the help in previous posts... couldn't have gotten where I am now without it! So here is what I have, I use AWK to match $1 and $2 as 1 string in file1 to $1 and $2 as 1 string in file2. Now I'm wondering if I can extend this AWK command to incorporate the following: If $1... (4 Replies)
Discussion started by: right_coaster
4 Replies

4. Shell Programming and Scripting

Compare two files and output difference, by first field using awk.

It seems like a common task, but I haven't been able to find the solution. vitallog.txt 1310,John,Hancock 13211,Steven,Mills 122,Jane,Doe 138,Thoms,Doe 1500,Micheal,May vitalinfo.txt 12122,Jane,Thomas 122,Janes,Does 123,Paul,Kite **OUTPUT** vitalfiltered.txt 12122,Jane,Thomas... (2 Replies)
Discussion started by: charles33
2 Replies

5. UNIX for Dummies Questions & Answers

compare two files based on common field in unix

I have two files in UNIX. 1st file is Entity and Second File is References. 1st File has only one column named Entity ID and 2nd file has two columns Entity ID | Person ID. I want to produce a output file where entity id's are matching in both the files. Entity File 624197 624252 624264... (4 Replies)
Discussion started by: PRS
4 Replies

6. Shell Programming and Scripting

Compare Field in Current Line with Field in Previous

Hi Guys I have the following file Essentially, I am trying to find the right awk/sed syntax in order to produce the following 3 distinct files from the file above: Basically, I want to print the lines of the file as long as the second field of the current line is equal to the... (9 Replies)
Discussion started by: moutaye
9 Replies

7. Shell Programming and Scripting

Compare a common field in two files and append a column from File 1 in File2

Hi Friends, I am new to Shell Scripting and need your help in the below situation. - I have two files (File 1 and File 2) and the contents of the files are mentioned below. - "Application handle" is the common field in both the files. (NOTE :- PLEASE REFER TO THE ATTACHMENT "Compare files... (2 Replies)
Discussion started by: Santoshbn
2 Replies

8. Shell Programming and Scripting

Compare two files Field by field and output the result in another file

Hi Friends, Need Help. I have file1.txt as File1.txt |123|A|7267|Hyder|Cross|Sell|7801 |995|A|7051|2008|Lunar|New|Year|Promotion|7801 |996|A|7022|Q108|Targ|Prospect|&|SSCC|Savings|Promo|7801 |997|A|7182|Q1|Feb-Apr|08|Credit|ITA|PA|SBA|Campaign|7801 File2.txt... (7 Replies)
Discussion started by: i150371485
7 Replies

9. Shell Programming and Scripting

Compare two CSV files and put the difference in third file with line no,field no and diff value.

I am having two csv files i need to compare these files and the output file should have the information of the differences at the field level. For Example, File 1: A,B,C,D,E,F 1,2,3,4,5,6 File 2: A,C,B,D,E,F 1,2,4,5,5,6 out put file: (12 Replies)
Discussion started by: karingulanagara
12 Replies

10. UNIX for Dummies Questions & Answers

Combine Similar Output from the 2nd field w.r.t 1st Field

Hi, For example: I have: HostA,XYZ HostB,XYZ HostC,ABC I would like the output to be: HostA,HostB: XYZ HostC:ABC How can I achieve this? So far what I though of is: (1 Reply)
Discussion started by: alvinoo
1 Replies
SG_TURS(8)							     SG3_UTILS								SG_TURS(8)

NAME
sg_turs - send one or more SCSI TEST UNIT READY commands SYNOPSIS
sg_turs [--help] [--number=NUM] [--progress] [--time] [--verbose] [--version] DEVICE sg_turs [-n=NUM] [-p] [-t] [-v] [-V] DEVICE DESCRIPTION
This utility sends one or more SCSI TEST UNIT READY commands to the DEVICE. This may be useful for timing the per command overhead. Note that TEST UNIT READY has no associated data, just a 6 byte command and a returned SCSI status value. This utility supports two command line syntaxes, the preferred one is shown first in the synopsis and explained in this section. A later section on the old command line syntax outlines the second group of options. OPTIONS
Arguments to long options are mandatory for short options as well. -h, --help print out the usage message then exit. -n, --number=NUM performs TEST UNIT READY NUM times. If not given defaults to 1. These suffix multipliers are permitted: c C *1; w W *2; b B *512; k K KiB *1,024; KB *1,000; m M MiB *1,048,576; MB *1,000,000; g G GiB *1,073,741,824; and GB *1,000,000,000 . Also a suffix of the form "x<n>" multiplies the leading number by <n>. Alternatively a hex number may be given, prefixed by either '0x' or has a trailing 'h'. -O, --old switch to older style options. -p, --progress show progress indication (a percentage) if available. If --number=NUM is given, NUM is greater than 1 and an initial progress indi- cation was detected then this utility waits 30 seconds before subsequent checks. Exits when NUM is reached or there are no more progress indications. Ignores --time option. See NOTES section below. -t, --time after completing the requested number of TEST UNIT READY commands, outputs the total duration and the average number of commands executed per second. -v, --verbose increase level or verbosity. -V, --version print version string then exit. NOTES
The progress indication is optionally part of the sense data. When a prior command that takes a long time to complete (and typically pre- cludes other media access commands) is still underway, the progress indication can be used to determine how long before the device returns to its normal state. The SCSI FORMAT command for disks used with the IMMED bit set is an example of an operation that takes a significant amount of time and precludes other media access during that time. The IMMED bit set instructs the FORMAT command to return control to the application client once the format has commenced (see SBC-3). Several long duration SCSI commands associated with tape drives also use the progress indication (see SSC-3). Early standards suggested that the SCSI TEST UNIT READY command be used for polling the progress indication. More recent standards seem to suggest the SCSI REQUEST SENSE command should be used instead. EXIT STATUS
The exit status of sg_turs is 0 when it is successful. Otherwise see the sg3_utils(8) man page. OLDER COMMAND LINE OPTIONS
The options in this section were the only ones available prior to sg3_utils version 1.23 . In sg3_utils version 1.23 and later these older options can be selected by either setting the SG3_UTILS_OLD_OPTS environment variable or using '--old' (or '-O) as the first option. -n=NUM performs TEST UNIT READY NUM times. If not given defaults to 1. Equivalent to --number=NUM in the main description. -N switch to the newer style options. -p show progress indication (a percentage) if available. Equivalent to --progress in the main description. -t after completing the requested number of TEST UNIT READY commands, outputs the total duration and the average number of commands executed per second. Equivalent to --time in the main description. -v increase level of verbosity. -V print out version string then exit. AUTHORS
Written by D. Gilbert COPYRIGHT
Copyright (C) 2000-2008 Douglas Gilbert This software is distributed under the GPL version 2. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PUR- POSE. SEE ALSO
sg_inq, sg_request (sg3_utils) sg3_utils-1.26 March 2008 SG_TURS(8)
All times are GMT -4. The time now is 05:47 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy