01-10-2012
merge two tab delimited file with exact same number of rows in unix/linux
Hi
I have two tab delimited file with different number of columns but same number of rows. I need to combine these two files in such a way that row 1 in file 2 comes adjacent to row 1 in file 1.
For example:
The content of file1:
field1 field2 field3
a1 a2 a3
b1 b2 b3
c1 c2 c3
File 2 contents:
field4 field5 field6 field7
d4 d5 d6 d7
e4 e5 e6 e7
f4 f5 f6 f7
After combining these two files becomes (again a tab delimited file):
field1 field2 field3 field4 field5 field6 field7
a1 a2 a3 d4 d5 d6 d7
b1 b2 b3 e4 e5 e6 e7
c1 c2 c3 f4 f5 f6 f7
Thanks for your help.
Mary
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
Can anyone let me know on how to convert a Tab delimited file to Comma delimited file in Unix
Thanks!! (22 Replies)
Discussion started by: charan81
22 Replies
2. Shell Programming and Scripting
Hi,
So my file looks like this:
title number
JR 2
JR 2
JR 4
JR 5
NM 5
NM 8
NM 2
NM 8
I used this line that I wrote to convert it to rows so it will look like this:
awk -F"\t" '!/^$/{a=a" "$3} END {for ( i in a) {print i,a}}' occ_output.tab > test.txt
JR 2 2 4 5
NM 5 8... (4 Replies)
Discussion started by: kylle345
4 Replies
3. Shell Programming and Scripting
Hi
I am trying to retrieve values from a tab-delimited file.I am using
while read record
value=`echo $record | cut -f12`
done
Where 12 is the column no i want retieve and record is one line of the file.
But it is returning the full record.
Plz help (4 Replies)
Discussion started by: akashtcs
4 Replies
4. UNIX for Advanced & Expert Users
I'm facing a strange problem, please help me out.
Here we go.
I want to count number of fields in particular file.
filename and delimiter character will be passed through parameter.
On command prompt if i type following i get 27 as output (which is correct)
cat customer.dat | head -1 | awk... (12 Replies)
Discussion started by: vikanna
12 Replies
5. UNIX for Dummies Questions & Answers
Hi,
I have the following code:
LIST=`ls | grep '.sql$'`
echo $LIST
The above code will give me something like..
file1.sh file2.sh file3.sh file4.sh file5.sh
I want to display the values into rows using echo like...
file1.sh
file2.sh (5 Replies)
Discussion started by: adshocker
5 Replies
6. UNIX for Dummies Questions & Answers
I have tried the following to no avail.
xargs -n8 < test.txt
awk '{if(NR%6!=0){p=""}else{p="\n"};printf $0" "p}' Mod_Alm_log.txt > test.txt
I have tried different variations of the above, the problem is mixes lines together.
And it includes the tags "%a and %A" I need them to be all tab... (16 Replies)
Discussion started by: mytouchsr
16 Replies
7. UNIX for Dummies Questions & Answers
Hi,
I need urgent help with a tab delimited file I am working on.
This is the file :
TTTT|YYYYYYY|jargon-journal|MP0000000UID||"j1, j2, j3"
I need th following output:
TTTT|YYYYYYY|jargon-journal|MP0000000UID||ji
TTTT|YYYYYYY|jargon-journal|MP0000000UID||j2... (8 Replies)
Discussion started by: rayarnab
8 Replies
8. UNIX for Dummies Questions & Answers
Hello!
I have a tab delimited file with values in three columns. Some values occur in all three columns, other values are present in only one or two columns. I would like to sort the file so that rows with no missing values come first, rows with one missing values come next, and rows with two... (9 Replies)
Discussion started by: MBarrett1213
9 Replies
9. UNIX for Dummies Questions & Answers
I have a file like this.
It is tab delimited.
Unfortunately, the missing data was filled in with a period "." (see the leading lines 1-5 columns)
I want to substitute the periods for misisng data with an integer "-999".
however, I do not want the global replace to change the other periods seen... (7 Replies)
Discussion started by: genehunter
7 Replies
10. Shell Programming and Scripting
Hello,
I have 40 data files where the first three columns are the same (in theory) and the 4th column is different. Here is an example of three files,
file 2: A_f0_r179_pred.txt
Id Group Name E0
1 V N(,)'1 0.2904
2 V N(,)'2 0.3180
3 V N(,)'3 0.3277
4 V N(,)'4 0.3675
5 V N(,)'5 0.3456
... (8 Replies)
Discussion started by: LMHmedchem
8 Replies
LEARN ABOUT DEBIAN
moosex::emulate::class::accessor::fast
MooseX::Emulate::Class::Accessor::Fast(3pm) User Contributed Perl Documentation MooseX::Emulate::Class::Accessor::Fast(3pm)
NAME
MooseX::Emulate::Class::Accessor::Fast - Emulate Class::Accessor::Fast behavior using Moose attributes
SYNOPSYS
package MyClass;
use Moose;
with 'MooseX::Emulate::Class::Accessor::Fast';
#fields with readers and writers
__PACKAGE__->mk_accessors(qw/field1 field2/);
#fields with readers only
__PACKAGE__->mk_ro_accessors(qw/field3 field4/);
#fields with writers only
__PACKAGE__->mk_wo_accessors(qw/field5 field6/);
DESCRIPTION
This module attempts to emulate the behavior of Class::Accessor::Fast as accurately as possible using the Moose attribute system. The
public API of "Class::Accessor::Fast" is wholly supported, but the private methods are not. If you are only using the public methods (as
you should) migration should be a matter of switching your "use base" line to a "with" line.
While I have attempted to emulate the behavior of Class::Accessor::Fast as closely as possible bugs may still be lurking in edge-cases.
BEHAVIOR
Simple documentation is provided here for your convenience, but for more thorough documentation please see Class::Accessor::Fast and
Class::Accessor.
A note about introspection
Please note that, at this time, the "is" flag attribute is not being set. To determine the "reader" and "writer" methods using
introspection in later versions of Class::MOP ( > 0.38) please use the "get_read_method" and "get_write_method" methods in
Class::MOP::Attribute. Example
# with Class::MOP <= 0.38
my $attr = $self->meta->find_attribute_by_name($field_name);
my $reader_method = $attr->reader || $attr->accessor;
my $writer_method = $attr->writer || $attr->accessor;
# with Class::MOP > 0.38
my $attr = $self->meta->find_attribute_by_name($field_name);
my $reader_method = $attr->get_read_method;
my $writer_method = $attr->get_write_method;
METHODS
BUILD $self %args
Change the default Moose class building to emulate the behavior of C::A::F and store arguments in the instance hashref.
mk_accessors @field_names
Create read-write accessors. An attribute named $field_name will be created. The name of the c<reader> and "writer" methods will be
determined by the return value of "accessor_name_for" and "mutator_name_for", which by default return the name passed unchanged. If the
accessor and mutator names are equal the "accessor" attribute will be passes to Moose, otherwise the "reader" and "writer" attributes will
be passed. Please see Class::MOP::Attribute for more information.
mk_ro_accessors @field_names
Create read-only accessors.
mk_ro_accessors @field_names
Create write-only accessors.
follow_best_practices
Preface readers with 'get_' and writers with 'set_'. See original Class::Accessor documentation for more information.
mutator_name_for
accessor_name_for
See original Class::Accessor documentation for more information.
set
See original Class::Accessor documentation for more information.
get
See original Class::Accessor documentation for more information.
meta
See Moose::Meta::Class.
SEE ALSO
Moose, Moose::Meta::Attribute, Class::Accessor, Class::Accessor::Fast, Class::MOP::Attribute, MooseX::Adopt::Class::Accessor::Fast
AUTHORS
Guillermo Roditi (groditi) <groditi@cpan.org>
With contributions from:
Tomas Doran (t0m) <bobtfish@bobtfish.net>
Florian Ragwitz (rafl) <rafl@debian.org>
LICENSE
You may distribute this code under the same terms as Perl itself.
perl v5.10.0 2009-09-15 MooseX::Emulate::Class::Accessor::Fast(3pm)