Compare two files, if the columns are same then replace next column with some value


 
Thread Tools Search this Thread
Top Forums UNIX for Beginners Questions & Answers Compare two files, if the columns are same then replace next column with some value
# 8  
Old 04-11-2020
Looks like T[$1] is the empty string? What's your input data?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. 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

2. Shell Programming and Scripting

Compare and replace two columns from two files

Hello, I have two text tab delimited files File 1 has 30 columns. I am pasting only first 9 Chr Position Ref Alt Score Gene HGVS_C HGVS_P Coding_Consequence dbSNP 1 17312743 C T 1 Gene1 - ... (2 Replies)
Discussion started by: nans
2 Replies

3. Shell Programming and Scripting

Compare two columns and replacing it with value from third column!!

Hi, I am new to Unix and I am finding it hard to fix a particular logic. The context is as below. File 1 : This contains of 5 fields : Type | Bank Code | Account | Name | Date/Time 60|ABC123|TX123456|XXXX|YYYYMMDDHH:MM:SS 72|ABC123|MYD34561|XXXX|YYYYMMDDHH:MM:SS... (4 Replies)
Discussion started by: DJose
4 Replies

4. Shell Programming and Scripting

Compare 2 csv files by columns, then extract certain columns of matcing rows

Hi all, I'm pretty much a newbie to UNIX. I would appreciate any help with UNIX coding on comparing two large csv files (greater than 10 GB in size), and output a file with matching columns. I want to compare file1 and file2 by 'id' and 'chain' columns, then extract exact matching rows'... (5 Replies)
Discussion started by: bkane3
5 Replies

5. Shell Programming and Scripting

Compare first column of 2 files and replace

Hi All, I have 2 files in the following format : File 1 S00999999|BHANU|TEST|007 JOHN DOE APT 999||VENGA HIGHWAY|MA|09566|SCO DUAL|20140201|20140331|20140401|20140630|20140327| S00888888|BU|TES|009 JOHN DOE APT 909||SENGA HIGHWAY|MA|08566|SCO... (1 Reply)
Discussion started by: nua7
1 Replies

6. Shell Programming and Scripting

Combine columns from many files but keep them aligned in columns-shorter left column issue

Hello everyone, I searched the forum looking for answers to this but I could not pinpoint exactly what I need as I keep having trouble. I have many files each having two columns and hundreds of rows. first column is a string (can have many words) and the second column is a number.The files are... (5 Replies)
Discussion started by: isildur1234
5 Replies

7. Shell Programming and Scripting

awk compare column n replace with in one file

hi Friends need to compare columns in one file where the data looks like below laptop,IBM phone,samsung car,rental user1,laptop user2,laptop user3,phone want to get output as laptop,IBM phone,samsung car,rental user1,IBM user2,IBM user3,samsung need to seach $2 in array of $1 and... (4 Replies)
Discussion started by: arun1401
4 Replies

8. Shell Programming and Scripting

Compare Two Files(Column By Column) In Perl or shell

Hi, I am writing a comparator script, which comapre two txt files(column by column) below are the precondition of this comparator 1)columns of file are not seperated Ex. file1.txt 8888812341181892 1243548895685687 8945896789897789 1111111111111111 file2.txt 9578956789567897... (2 Replies)
Discussion started by: kumar96877
2 Replies

9. Ubuntu

How to compare two columns and fetch the common data with additional column

Dear All, I am new to this forum and please ignore my little knowledge :p I have two types of data (a subset is given below) data version 1: 439798 2 1 451209 1 2 508696 2 1 555760 2 1 582757 1 2 582889 1 2 691827... (2 Replies)
Discussion started by: evoll
2 Replies

10. UNIX for Dummies Questions & Answers

find common lines using just one column to compare and result with all columns

Hi. If we have this file A B C 7 8 9 1 2 10 and this other file A C D F 7 9 2 3 9 2 3 4 The result i´m looking for is intersection with A B C D F so the answer here will be (10 Replies)
Discussion started by: alcalina
10 Replies
Login or Register to Ask a Question
bup-restore(1)						      General Commands Manual						    bup-restore(1)

NAME
bup-restore - extract files from a backup set SYNOPSIS
bup restore [--outdir=outdir] [-v] [-q] DESCRIPTION
bup restore extracts files from a backup set (created with bup-save(1)) to the local filesystem. The specified paths are of the form /branch/revision/path/to/file. The components of the path are as follows: branch the name of the backup set to restore from; this corresponds to the --name (-n) option to bup save. revision the revision of the backup set to restore. The revision latest is always the most recent backup on the given branch. You can dis- cover other revisions using bup ls /branch. /path/to/file the original absolute filesystem path to the file you want to restore. For example, /etc/passwd. Note: if the /path/to/file is a directory, bup restore will restore that directory as well as recursively restoring all its contents. If /path/to/file is a directory ending in a slash (ie. /path/to/dir/), bup restore will restore the children of that directory directly to the current directory (or the --outdir). If the directory does not end in a slash, the children will be restored to a subdirectory of the current directory. See the EXAMPLES section to see how this works. OPTIONS
-C, --outdir=outdir create and change to directory outdir before extracting the files. -v, --verbose increase log output. Given once, prints every directory as it is restored; given twice, prints every file and directory. -q, --quiet don't show the progress meter. Normally, is stderr is a tty, a progress display is printed that shows the total number of files restored. EXAMPLE
Create a simple test backup set: $ bup index -u /etc $ bup save -n mybackup /etc/passwd /etc/profile Restore just one file: $ bup restore /mybackup/latest/etc/passwd Restoring: 1, done. $ ls -l passwd -rw-r--r-- 1 apenwarr apenwarr 1478 2010-09-08 03:06 passwd Restore the whole directory (no trailing slash): $ bup restore -C test1 /mybackup/latest/etc Restoring: 3, done. $ find test1 test1 test1/etc test1/etc/passwd test1/etc/profile Restore the whole directory (trailing slash): $ bup restore -C test2 /mybackup/latest/etc/ Restoring: 2, done. $ find test2 test2 test2/passwd test2/profile SEE ALSO
bup-save(1), bup-ftp(1), bup-fuse(1), bup-web(1) BUP
Part of the bup(1) suite. AUTHORS
Avery Pennarun <apenwarr@gmail.com>. Bup unknown- bup-restore(1)