How to compare 2 files & get specific value & replace it in other file.
Hiiii Friends
I have 2 files with huge data. I want to compare this 2 files & if they hav same set of vales in specific rows & columns i need to get that value from one file & replace it in other.
For example: I have few set data of both files here:
a.dat:
The other file has data as shown below
b.dat:
The output file c.dat : after comparing this 2 files should be
Now in this 2 files it will check for same dat & in time for same hour & mins
for ex:
In b.dat, The year month day hour & mins of 11row is same as the a.dat 's 2nd row 's year month day hour & mins.
Now we should check if th Mw value 5.7 of the b.dat file is thier in the 2nd row's 15th column If so leav as it is or els replace the 0.00 to what ever the value is..
Now if we apply the same logic for date 2010 2 27 & time 23 21 of b.dat & a.dat. The Mw value 5.6 is not thier in the 11thcolumn of 6th row in a.dat. Here the 0.00 should be replaced as 5.6.
Help me out using awk or simple shell program..
for the same data above if i replace the date & time in b.dat as
Date: 2010/ 3/5 Centroid Time: 19:19: 4.8 GMT
Then the result s same ...
its not printing the result in c.dat correctly as
I have a environment property file which contains:
Input file:
value1 = url1
value2 = url2
value3 = url3 and so on.
I need to search all *.xml files under directory for value1 and replace it with url1.
Same thing I have to do for all values mentioned in input file. I need script in unix bash... (7 Replies)
Hi All,
I have written a shell script that creates a backup of my MySQL database. The script performs the following functions:
Creates a Backup of the MySQL database
Compresses the Backup
Copies the Backup to a Remote Server
Send an E-Mail displaying the size of the Backup
Removes any... (6 Replies)
I need to replace dashes (i.e. -) if present from positions 351-357 with zero (i.e. 0), I also need to replace dash (i.e “-“) if present between position 024-043 with zero (i.e. 0) & I replace " " (i.e. 2 space characters) if present at position 381-382 with "04". Total length of record is 413.... (11 Replies)
Hello,
I'm trying the solve the following problem.
I have a file which I intend to use as a csv called master.csv
The columns are separated by commas.
I want to change the text on a specific row in either column 3,4,5 or 6 from xxx to yyy depending upon if column 1 matches a specified pattern.... (3 Replies)
Hi, I have text file abc.txt. In this file, I have the following data.
Input:
Mr Smith & Mrs Smith
Mr Smith &apos Mrs Smith
Mr Smith & Mrs Smith
Mr Smith& Mrs Smith
Mr Smith &Mrs Smith
Output:
Mr Smith & Mrs Smith
Mr Smith &apos Mrs Smith
Mr Smith & Mrs Smith
Mr Smith&... (4 Replies)
Hi,
I have a folder which contains multiple config.xml files and one input file, Please see the below format.
Config Files format looks like :-
Code:
<application name="SAMPLE-ARCHIVE">
<NVPairs name="Global Variables">
<NameValuePair>
... (0 Replies)
Hello All
I have a xml file with many sets of records
like this
<mytag>mydata</mytag>
<tag2>data&</tag2>
also same file can be like this
<mytag>mydata</mytag>
<tag2>data&</tag2>
<tag3>data2&data3</tag3>
Now i can grep & and replace with & for whole file but it will replace all... (4 Replies)
Friends,
i have two huge complex files (for eg :A & B)as output ,
the sample contents of the files are as follows :
A
==
ID,DATE,SUM1,SUM2,TOTAL(SUM1+2)
A5066,20/04/2010,25000,50000,75000
A5049,20/04/2010,25000,60000,85000
B
==
ID,DATE,SUM1,SUM2,TOTAL(SUM1+2)... (2 Replies)
find . -type f -name "*.sql" -print|xargs perl -i -pe 's/pattern/replaced/g'
this is simple logic to find and replace in multiple files & folders
Hope this helps.
Thanks
Zaheer (0 Replies)