Merging of two files using unix utilitie
I have one static file with some tags in it. And I have one data file with the values and its position like page number, line number, column number.
No how do I merge these to files by using unix utilities.
Linux
I have one static file with some tags in it. And I have one data file with the values and its position like page number, line number, column number.
No how do I merge these to files by using unix utilities.
by vinnyd
You did not say what the resulting file should look like.
To combine two files together you can use the copy command.
cp sourcefile1+sourcefile2 destinationfile
That will put the two files together in sequencial order.
To merge them together like tags, page#, line#, column# you have to write a program to do it.
by vaddavalli
by lurid
cat file1 >> file2
this will append file2 to the end of file one
by vaddavalli
by tyswidan
IJust use the simple cat utility, for example if you have fil1 ( with tags)
and file2 ( with the data), all you have to do is:
cat file2 >> file1
done.
hope that helps.
by vaddavalli
by gordon
by vaddavalli
by wcf
by vaddavalli
by a_rashad
you need to format file1 with a config. file2 ?
if so it is more likely to be done using a C program or a hard shell script
look for the following tools (for , cut , echo , head , typeset and sort).
main idea is that you will read from file2 theconfig file and place the values into variables such variables you will use to format file1 you have to sort values first then use echo to place the tags in the right places
use spaces and "\n" for positionsing after sorting the positions
by vaddavalli
by achuprinin
I's unclear from your question what kind of data represent your files. If the fist file contains format information for output data from the second one and files not binary.
Then you can use awk for making your output file. It allows using templates and may be run from command line without writing separate program file. And opposite right also. You can write program file that awk will use. The second approach is usefull when you going to make output file multiple times.
by vaddavalli
by rsati
actually, Ur question is not clear...
i assume that u have like this
file 1 has
page no column no line no
file 2 has
1 10 10
if want like this
file 3
page no 1 column no 10 line no 10
U can use cut and paste utility of unix andcan do that...
by vaddavalli
by vaddavalli
This discussion is closed to new replies.
Sort by Trending