Copy values from columns matching in those in second file.
Hi All,
I have two sets of files.
Set 1: 100 text files with extension .txt with names like 1.txt, 2.txt, 3.txt until 100.txt
Set 2: One big file with extension .dat
The text files have some records in columns like this:
All the .TXT files look the same but with different numbers.
My big .DAT file looks like this:
Now, the important observation in the two files is that numbers in column 2 in 100 .TXT files are sure to be found in column 2 of .DAT file.
I want to:
1. Read the .TXT files one by one.
2. Extract the first column from .DAT when the number in the second column from .TXT matches with that in the .DAT file and write the result like this in 1.res file considering that I am reading 1.txt file and same goes for 2.txt where I create 2.res file until 100.res:
As you can see above that the numbers in the second column of .TXT files that matched with the numbers in the second column in the big file (.DAT), I have extracted only the numbers from the first column of the matching second column numbers and wrote the result in 1.res file.
I am using Linux with BASH.
I've been trying with some codes that I could get in this forum but after failing turned back here. This is what I wrote but it does not do anything expect return blank.
I have a file abc.csv, from which I need column 24(PurchaseOrder_TotalCost) to get the sum_of_amounts with date and row count into another file say output.csv
abc.csv-
UTF-8,,,,,,,,,,,,,,,,,,,,,,,,,
... (6 Replies)
Not sure if this is the correct forum for this question. I have two files. file1.zip, file2
Input:
file1.zip
col1, col2 , col3
a , b , 0:0:0:0:0:c436:9346:d40b
x, y, 0:0:0:0:0:880:39f9:c9a7
m, n , 0:0:0:0:0:80c7:9161:fe00
file2.txt
col1
c4:36:93:46:d4:0b... (1 Reply)
Hello Help,
2356798 7689867 999 000
123678 20385907 9797 666
17978975 87468976 968978 98798
I am trying to have out put which actually look for the third column value of 9797 and then it insert line there after with first, second column value exactly as the previous line and replace the third... (3 Replies)
Hi all,
I have 2 files:
species-names.txt
Abaca-bunchy-top-virus ((((Abaca-bunchy-top-virus((Babuvirus((Unassigned((Nanoviridae((Unassigned))))
Abutilon-mosaic-virus ((((Abutilon-mosaic-virus((Begomovirus((Unassigned((Geminiviridae((Unassigned))))... (2 Replies)
Hello Friends,
I have a CDR file and i need to print out 2 columns with their field position which matches to some constant values,
a part of input file
CZ=1|CZA=1|DIAL=415483420001|EE=13|ESF=1|ET=|FF=0|9|MNC=99|MNP=9041|MTC=0|NID=2|NOA=international|ON=1|
OutPut
... (3 Replies)
- I have two files (File 1 and File 2) and the contents of the files are mentioned below.
- I am trying to compare the values of Column1 of File1 with Column1 of File2. If a match is found, print the corresponding value from Column2 of File1 in Column5 of File2.
- I tried to modify and use... (10 Replies)
I have a text file that has three columns. But at the end of the text file, there are trailing lines that have missing second and third columns:
4 0.04972604 KLHL28
4 0.0497332 CSTB
4 0.04979822 AIF1
4 0.04983331 DECR2
4 0.04990344 KATNB1
4
4
4
4
How can I remove the trailing... (3 Replies)
Hi Guys !
i want to search a record in file by matching two values in a record in two different columns
suppose i have 3 columns
and i want to select all those values from col1 for which in col3 has a specific value
e.g select all "john" from column1 where column 3 has a value of "20"
... (9 Replies)
I am trying to match first 5 values of $passt variable in a file $chpdvlst and then verify that value in $grp parameter I want first 5 values which has $vaht - ship and $grp = N-grp. Somehow script below lists whole file.
$memcnt = 5;
$passt = ship;
open (ADVOUT, "< $chpdvlst") || die... (5 Replies)