General discussion
-
CreatorTopic
-
January 24, 2000 at 10:55 pm #2081791
Merging of two files using unix utilitie
Lockedby vaddavalli · about 22 years, 4 months ago
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.Topic is locked -
CreatorTopic
All Comments
-
AuthorReplies
-
-
January 24, 2000 at 11:18 pm #3897137
Merging of two files using unix utilitie
by vinnyd · about 22 years, 4 months ago
In reply to Merging of two files using unix utilitie
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.
-
September 20, 2000 at 7:02 pm #3742401
Merging of two files using unix utilitie
by vaddavalli · about 21 years, 8 months ago
In reply to Merging of two files using unix utilitie
The question was auto-closed by TechRepublic
-
-
January 26, 2000 at 4:56 am #3897077
Merging of two files using unix utilitie
by lurid · about 22 years, 4 months ago
In reply to Merging of two files using unix utilitie
cat file1 >> file2
this will append file2 to the end of file one-
September 20, 2000 at 7:02 pm #3742402
Merging of two files using unix utilitie
by vaddavalli · about 21 years, 8 months ago
In reply to Merging of two files using unix utilitie
The question was auto-closed by TechRepublic
-
-
January 26, 2000 at 4:36 pm #3897051
Merging of two files using unix utilitie
by tyswidan · about 22 years, 4 months ago
In reply to Merging of two files using unix utilitie
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.
-
September 20, 2000 at 7:02 pm #3742403
Merging of two files using unix utilitie
by vaddavalli · about 21 years, 8 months ago
In reply to Merging of two files using unix utilitie
The question was auto-closed by TechRepublic
-
-
February 15, 2000 at 8:43 am #3897889
Merging of two files using unix utilitie
by gordon · about 22 years, 3 months ago
In reply to Merging of two files using unix utilitie
If the above answers your question, look no further, otherwise: Welcome to the world of hard-core unix: You need to refine your question. If the files are line-for-line ok and you just want to do a “column-merge” look at: paste -d If the tags in the first file refer to a line in the second file, then you may need to sort one (or both) files first-> get rid of duplicates (uniq) -> get rid of other stuff (cut, grep, sed) and then finally join (one of the harder commands to master). I had two files I had to merge together: One had IP addresses and printer names, the other had printer names and printer setups. I “linked” them together with the printer name, but had a lot of cleaning up to do first… Presevere, there is daylight after you master these. (My end file was 2900 bytes long, so it’s a LOT smaller than any ‘C’ program)
-
September 20, 2000 at 7:02 pm #3742404
Merging of two files using unix utilitie
by vaddavalli · about 21 years, 8 months ago
In reply to Merging of two files using unix utilitie
The question was auto-closed by TechRepublic
-
-
February 21, 2000 at 1:41 am #3897693
Merging of two files using unix utilitie
by wcf · about 22 years, 3 months ago
In reply to Merging of two files using unix utilitie
There are too many unknowns in your question for a definitive answer, but a general solution is to broaden your constraints slightly and use Perl, available on most systems. One line of code to open each file, a line or two of code to read the datafile into a hash table, and another line or 2 to scan the tag table gor tags and substitute from the hash table. This kind of problem is why Perl exists!
-
September 20, 2000 at 7:02 pm #3742405
Merging of two files using unix utilitie
by vaddavalli · about 21 years, 8 months ago
In reply to Merging of two files using unix utilitie
The question was auto-closed by TechRepublic
-
-
February 22, 2000 at 12:39 pm #3897625
Merging of two files using unix utilitie
by a_rashad · about 22 years, 3 months ago
In reply to Merging of two files using unix utilitie
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-
September 20, 2000 at 7:02 pm #3742406
Merging of two files using unix utilitie
by vaddavalli · about 21 years, 8 months ago
In reply to Merging of two files using unix utilitie
The question was auto-closed by TechRepublic
-
-
February 28, 2000 at 5:17 pm #3900555
Merging of two files using unix utilitie
by achuprinin · about 22 years, 3 months ago
In reply to Merging of two files using unix utilitie
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.-
September 20, 2000 at 7:02 pm #3742407
Merging of two files using unix utilitie
by vaddavalli · about 21 years, 8 months ago
In reply to Merging of two files using unix utilitie
The question was auto-closed by TechRepublic
-
-
March 25, 2000 at 12:58 am #3901559
Merging of two files using unix utilitie
by rsati · about 22 years, 2 months ago
In reply to Merging of two files using unix utilitie
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 10U can use cut and paste utility of unix andcan do that…
-
September 20, 2000 at 7:02 pm #3742408
Merging of two files using unix utilitie
by vaddavalli · about 21 years, 8 months ago
In reply to Merging of two files using unix utilitie
The question was auto-closed by TechRepublic
-
-
September 20, 2000 at 7:02 pm #3742400
Merging of two files using unix utilitie
by vaddavalli · about 21 years, 8 months ago
In reply to Merging of two files using unix utilitie
This question was auto closed due to inactivity
-
-
AuthorReplies