Replace values in a file with values from another file
Hi,
I have 2 input files:
File 1:
File 2:
................................
Need to replace the contents of File 1 with column 2, 3 & 4 values of File 2 where ever column 1 of File 2 matches with the words in File 1. The number of output files would be number of columns in File 2 minus 1. In this case it would be 3.
ie., Contents of Output File1 (cre_AAA.sh) would be:
Contents of Output File2 (cre_BBB.sh) would be:
Contents of Output File3 (cre_CCC.sh) would be:
and so on ...
File 1 is static but File 2 would be dynamic. There could be many columns (AAA, BBB,...FFF) and parameters (Name, dir, group, ... location) in it.
Can someone please help me with this?
Thanx
-Gc
Last edited by Scrutinizer; 10-13-2013 at 07:38 PM..
Reason: code tags
Gents,
Please i need your help.
Using the file2.txt i will like to replace values in file3.txt.
Example in file 2 column 1 is the value to find in file3.txt and replace with value in colunm2 (file2.txt).
Example
file2.txt
21 1209
22 1210file3.txt
SCI TB Timestamp Local : 8/30/17... (2 Replies)
Hi,
I'd be grateful for your help with the following:
I have a file with a single column (file1). Let's say the values are:
a
b
c
5
d
I have a second, reference file (ref_file), which is colon-delimited, and is effectively a key. Let's say the values in it are:
a:1
b:2
c:3
d:4... (4 Replies)
Gents,
Please can you help me.
I need to update file1 using file2 values
file1
S 44519.00 49349.00 1V1 0.0 0 0.0 0.0 0.0 0.0289091513
S 44513.00 48581.00 1V1 0.0 0 0.0 0.0 0.0 0.0289094319
S 44511.00 48605.00 1V1 0.0 0 0.0... (1 Reply)
I have one file as it has the following format
File1
S No Site IP Address
1 Australia 192.168.0.1/26
2 Australia 192.168.0.2/26
3 Australia 192.168.0.3/26
I need awk/sed command to replace the column2 value ( under Site) with some other... (8 Replies)
Hi
I have a file which has values in each line:
MP304,d40000
MP310,ff0000
etc
I have another file which as the first value in it and is unique in the file(not repeated). I need to replace a string with the second value above. The second file contents is as follows:(snippet)
<g
... (12 Replies)
hi,
i have variable value as follows
val="/dir1/dir2/dir3/dir4/dir5/dir6/file1"
it is pointing to some file location.
and i have another file as
../../dir4/file3
../../dir4/dir5/file4
../../dir7/file5
i want the output as
/dir1/dir2/dir3/dir4/file3 (7 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)
Dear all,
I have a file1.pdb in pdb format and a dat file2 containing values, corresponding to the atoms in the pdb file. these values (file2.dat) need to be in the column instead of the 0.00 (file1) values for each atom in file1.pdb .(the red values must be replaced by the blue ones,in order)... (11 Replies)
Hello,
I have a file with four columns and I would like to replace values in the second column only.
An arbitrary example is:
100 A 105 B
200 B 205 C
300 C 305 D
400 D 405 E
500 E 505 F
I need to replace the second column as shown below:
... (4 Replies)