10-27-2009
Append file
Hello all,
I require assistance in combining files.
This is the scenario: I've got lots of files which contain one column in each file and would like to combine the files into one so that the contents of the file can be sorted.
For example,
File 1 File 2 ...
a d
b e
c f
Desired output;
File 3
a
b
c
d
e
f
I tried paste/cat but the output (as follows) is not what I wanted)
File 3
a d
b e
c f
Any suggestions?
Thanks.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi All,
I have two comma separated value(CSV) files, say FileA and FileB.
The contents looks like that shown below.
FileA
EmpNo,Name,Age,Sex,
1000,ABC,23,M,
1001,DES,24,F, ... (2 Replies)
Discussion started by: ultimate
2 Replies
2. UNIX for Dummies Questions & Answers
AIX 5.3 / KSH
I have a Java application which creates a log file a.log. I have a KSH script which does the following action
cp a.log /directory2/b.log
> a.log
After this the file size goes to 0 as per "ls -l"
Then next time when the application writes into this file, the file size... (4 Replies)
Discussion started by: firdousamir
4 Replies
3. Solaris
I want to gzip a file and append the creation date to the end of the file. How can I accomplish this task. Basically they are log files which need a creation date stamp appended to make sure they do not overwrite other log files.
-jack (3 Replies)
Discussion started by: jacktravine
3 Replies
4. UNIX for Dummies Questions & Answers
I have a file "sample.txt" with the content as below:
Hi
This is a Sample Text.
I need a single command using cat which serve the following purpose.
1.display the contents of sample.txt
2.append some text to it
3. and then exit
But, all should be served by a sinle command.:confused: (1 Reply)
Discussion started by: g.ashok
1 Replies
5. Shell Programming and Scripting
Hi Experts,
I am working on HP-UX. I am new to shell scripting. I would like to have a shell script which will prefix:
1. "H|" before first row of my file and,
2. "T" for all other rows of the file.
For Example - File before running the script 20100430|4123451810|218.50|TC
20100430 ... (4 Replies)
Discussion started by: phani333
4 Replies
6. Shell Programming and Scripting
Hi ,
I have a file myhost.txt which contains below,
127.0.0.1 localhost
1.17.1.5 atrpx958
11.17.10.11 atrpx958zone nsybhost
I need to append words only after "atrpx958" like 'myhost' and 'libhost' and not after atrpx958zone.
How to search the word atrpx958(which is hostname) only,... (5 Replies)
Discussion started by: gsreeni
5 Replies
7. UNIX for Dummies Questions & Answers
Hi ladies and gentleman.. I have two text file with me. I need to replace one of the file content to another file if one both files have a matching pattern.
Example:
text1.txt:
ABCD 1234567,HELLO_WORLDA,HELLO_WORLDB
DCBA 3456789,HELLO_WORLDE,HELLO_WORLDF
text2.txt:
XXXX,ABCD... (25 Replies)
Discussion started by: bananamen
25 Replies
8. Shell Programming and Scripting
Hi,
I need help with this-
input.txt :
L B white
X Y white
A B brown
M Y black
Read this input file and if 3rd column is "white", then add specific lines to another file insert.txt.
If 3rd column is brown, add different set of lines to insert.txt, and so on.
For example, the given... (6 Replies)
Discussion started by: prashob123
6 Replies
9. Shell Programming and Scripting
I was thinking something like
for i in `find . -name "*.log.Z"`; do mv $i name.log.Z
or something like that? (3 Replies)
Discussion started by: xgringo
3 Replies
10. UNIX for Beginners Questions & Answers
In the awk below I am trying to cp and paste each matching line in f2 to $3 in f1 if $2 of f1 is in the line in f2 somewhere. There will always be a match (usually more then 1) and my actual data is much larger (several hundreds of lines) in both f1 and f2. When the line in f2 is pasted to $3 in... (4 Replies)
Discussion started by: cmccabe
4 Replies
comb(1) General Commands Manual comb(1)
NAME
comb - combine SCCS deltas
SYNOPSIS
SID] list] file ...
DESCRIPTION
The command generates a shell procedure (see sh(1)) which, when run, reconstructs the given SCCS files. The reconstructed files are usu-
ally smaller than the original files. Arguments can be specified in any order, but all options apply to all named SCCS files. If a direc-
tory is named, behaves as though each file in the directory were specified as a named file, except that non-SCCS files (last component of
the path name does not begin with and unreadable files are silently ignored. If a name of is given, the standard input is read; each line
of the standard input is taken to be the name of an SCCS file to be processed; non-SCCS files and unreadable files are silently ignored.
The generated shell procedure is written on the standard output.
Options
recognizes the following options. Each is explained as if only one named file is to be processed, but the effects of any option apply
independently to each named file.
The SCCS IDentification string (SID) of the oldest delta to be preserved. All older deltas are discarded in the recon-
structed file.
A list of deltas to be preserved (see get(1) for the syntax of a list). All other deltas are discarded.
For each generated, this option causes the reconstructed file to be accessed at the release of the delta to be created, other-
wise the reconstructed file would be accessed at the most recent ancestor. Use of the option can decrease the size
of the reconstructed SCCS file. It can also alter the shape of the delta tree of the original file.
This option causes
to generate a shell procedure which, when run, produces a report giving, for each file: the file name, size (in
blocks) after combining, original size (also in blocks), and percentage change computed by:
100 x (original - combined) / original
It is recommended that this option be used before any SCCS files are actually combined to determine exactly how much
space is saved by the combining process.
If no options are specified, preserves only leaf deltas and the minimal number of ancestors needed to preserve the tree.
EXTERNAL INFLUENCES
International Code Set Support
Single- and multi-byte character code sets are supported.
DIAGNOSTICS
Use sccshelp(1) for explanations.
EXAMPLES
The command:
creates a shell script named which if executed, creates a new using only the deltas from the old The script overwrites the old thus, it
might be wise to copy the original elsewhere. Here is an example of typical technique:
WARNINGS
may rearrange the shape of the tree of deltas. Combining files may or may not save space; in fact, it is possible for the reconstructed
file to actually be larger than the original.
FILES
Temporary file
Temporary file
SEE ALSO
admin(1), delta(1), get(1), sccshelp(1), prs(1), sh(1), sccsfile(4).
comb(1)