Creating a Third File from Information Contained in Two Files
In advance, I appreciate any help or tips. I apologize for not providing examples of scripts I have already tried, the reason is that I am new to programming and do not really no where to start. I think this is possible with awk, but do not know how to go about learning how to write the script that would do the trick (ie, which commands to read up on).
I have two files:
File1
File2
I would like to create a third file, File3, from File1 and File2 based on the following rules:
-the first two columns of File3 will be identical File1
-the third column in File3 will:
---contain the value from column2,File2 if the value from column1,File1 is present in column1,File2.
---contain the value from column2,file1 if the value from column2, file1 was 2
---contain the value "missing" if both (a) the ID in column1,File1 is not present in Column1,File2 and (b) the value in column2,File1 is not 2
Desired Output
Moderator's Comments:
Please use code tags when posting data and code samples!
Last edited by vgersh99; 08-27-2012 at 08:10 PM..
Reason: code tags, please!
Am using Linux 3.10
years.txt is input source file which has the list of year like below
2013
2014
2015
2016
Other Input files are
XX_TEST1_YR2016_01012018.csv
XX_TEST1_YR2015_01012018.csv
XX_TEST1_YR2014_01012018.csv
XX_TEST1_YR2013_01012018.csv
XX_TEST2_YR2016_01012018.csv... (2 Replies)
Hello.
I am trying to get some info from log file.
I have fileA , which contains all the country prefixes (the file contains one column and "n" rows ).
And i have fileB, which contains huge data of phone numbers (the file contains one column and "n" rows).
What i want to do is, to count... (7 Replies)
Hi Everyone !
I have two files with the same configuration
and I want to multiply corresponding values and write the result in a file.
Let say 2 header lines and then lines of values (with not constant number of columns):
more file1.txt -->
BLABLABLA
BLABLABLA
1 2 3 4
1 2 3
1 2
1... (7 Replies)
Hi All !
As a dummy, I try to search for multiple string of characters contained in 2 types of list.
Not clear? No it's not.
Example:
I have a tab-delimited file called "inventory" with 2 columns that looks like that:
#ref #year,color
xrt3 2000,blue
gf5 2000,red,green,yellow... (4 Replies)
Hi All,
I have an AIX executable (/usr/bin/shell) in my system.
I want to know if this file was updated by any of the installed fixes/apars on my system.
What is the AIX way of finding this information?
Greetings,
Peter (1 Reply)
I have some variables containing for example
m02-npt02-sr40-syn-dv0p01-16x12drw
m02-npt02-sr40-syn-dv0p02-16x12drw
m02-npt02-sr40-dv0p03-syn-16x12drw
I want to extract the dv entry for example
dv0p01
dv0p02
dv0p03
Then I want to convert to a numeric, the p specifies the... (5 Replies)
I have to rename a large number of files so that the name of each file corresponds to a code number that is given side by side in a list (textfile).
The list contains in column A the filename of the actual files to be renamed and in column B the name (a client code, 9 digits) that has to be... (7 Replies)
Hi,
I have a file containing data:
systemname/userid/password/comment
systemname1/userid1/password1/comment1
systemname2/userid2/password2/comment2
I want to modify the "password" using script.
Can anybody help me with this problem?:confused: (2 Replies)
Hi I am loking for some help in writing a script that will take a number that is located in one file and search a folder structure for that string in any file under that directory. I can do this manually with :
find /"directory" -type f -exec grep -l 'Number String' {} \;
But now I will... (3 Replies)
Hi
I have an xml file which has multiple xml records..
I don't know how to read those records and pipe them to another shell command
the file is like
<abc>z<def>y<ghi>x........</ghi></def></abc> (1st record)
<jkl>z<mno>y<pqr>x........</pqr></mno></jkl> (2nd record)
Each record end... (4 Replies)