03-09-2012
Reading columns, making a new file using another as template
Hi fellas,
I have two files such as:
File 1
interacao,AspAsp,AspCys,CysAsp,CysCys,classe
File 2
interacao,AspAsp,CysAsp,AspCys,CysCys,classe
beta_alfa, DA, CA, DD, CD,ppi
Thus, I want to make a File 3 using the File 1 as model:
e.g.
File 3
interacao,AspAsp,AspCys,CysAsp,CysCys,classe
beta_alfa, DA, DD, CA, CD,ppi
NOTE: I inseted the spaces in the File 2 and File 3 examples just to be easier to see.
In the example I just gave 6 columns, but my real file has 402 columns.
So, to do an awk -F "," '{print $1","$2","$4","$3","$5","$6}'
will not work because I dont know the position of the itens of the File 1 in the File 2 (for example the AspCys could be the sixth, the second, or the last columns).
I hope that you can help me and I would like an small explanation of the code, because I'm newbie and do not know a lot the commands.
Thanks in advance.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I am trying to read 2 files and writing to the 3rd file if I find the same elements in 2 files. my first file is
1 0 kb12124819 766409 1.586e-01
1 0 kb17160939 773886 8.674e-01
1 0 kb4475691 836671 8.142e-01
1 0 ... (2 Replies)
Discussion started by: ezhil01
2 Replies
2. Shell Programming and Scripting
1-) For the command below, I want to read second column: 32751. How will I get it ?
$ ps -ef|grep deneme
U00 32751 22745 0 16:30 pts/1 00:00:00 ksh deneme
U00 32762 32132 0 16:30 pts/2 00:00:00 grep deneme
2-) For the command below, how will I read all lines line by line? For... (1 Reply)
Discussion started by: senem
1 Replies
3. Shell Programming and Scripting
I want to read only one column in "|" delimited file and write that column to a new file.
For Ex:
Input File
1|abc|324|tt
2|efd|11|cbcb
3||1|fg
4|ert|23|88
Output : I want to read column 3 in diff file.
324
11
1
88
Can anyone give me inputs on this ? (2 Replies)
Discussion started by: net
2 Replies
4. Shell Programming and Scripting
Hi,
I'm working on a script that will take the contents of a file, that is in a row and column format, and compare it to a arrangment file. Such that if there is any or all blanks in my content file, the blank will be filled with a flag and will retain the row and column configuration.
Ex.
... (2 Replies)
Discussion started by: hizzle
2 Replies
5. Shell Programming and Scripting
Dear All,
I have a template xml file like below.
....Some---Header.......
<SignalPreference>
...
<SignalName>STRING</SignalName>
...
</SignalPreference>
......Some formatting text.......
<SignalPreference>
.........
... (3 Replies)
Discussion started by: ks_reddy
3 Replies
6. Programming
Dear all,
I am novice in C+= programing. I would like to seek help in one of the progra. Here it is, I have txt file which has the data as following order
varA varB
-21 0
-21.2 3, 4, 5, 6
-21.4 45, 65, 87, 98, 98
-22.0 345677, 349887, 98766, 877654, 987543
-23.0 76549,... (17 Replies)
Discussion started by: emily
17 Replies
7. Shell Programming and Scripting
Hi,
I am not so familiar with bash scripting and would appreciate your help here.
I have a text file 'input.txt' like this:
2 3 4
5 6 7
8 9 10
I want to store each column in an array like this
a ={2 5 8}, b={3 6 9}, c={4 7 10}
so that i can access any element, e.g b=6 for the later use. (1 Reply)
Discussion started by: Asif Siddique
1 Replies
8. Shell Programming and Scripting
Hello,
I have a directory with allot of tab delimited text files that have data that look like,
filePath distance
(1,4-dioxan-2-ylmethyl)methylamine 0.0
4-methylmorpholine 0.0755473632594
1-propyl-4-piperidone 0.157792911954
heptaminol 0.158142893249
N-acetylputrescine 0.158689628956... (3 Replies)
Discussion started by: LMHmedchem
3 Replies
9. Shell Programming and Scripting
Hi All,
I want to read an excel file.
PFA excel, I want to read the cloumn from A to G and the V to AH
starting from Row number 3.
Please help me on this. (7 Replies)
Discussion started by: Abhisrajput
7 Replies
10. Shell Programming and Scripting
Hello,
Please help in how to read rows and columns using array and print them.
I have below output and i want to store this in array and print the required rows or columns.
aaaaaaa 123
bbbbbb 456
ccccccc 888
Use code tags, thanks. (1 Reply)
Discussion started by: Cva2568
1 Replies
LEARN ABOUT CENTOS
file::homedir::unix
File::HomeDir::Unix(3) User Contributed Perl Documentation File::HomeDir::Unix(3)
NAME
File::HomeDir::Unix - Find your home and other directories on legacy Unix
SYNOPSIS
use File::HomeDir;
# Find directories for the current user
$home = File::HomeDir->my_home; # /home/mylogin
$desktop = File::HomeDir->my_desktop; # All of these will...
$docs = File::HomeDir->my_documents; # ...default to home...
$music = File::HomeDir->my_music; # ...directory
$pics = File::HomeDir->my_pictures; #
$videos = File::HomeDir->my_videos; #
$data = File::HomeDir->my_data; #
DESCRIPTION
This module provides implementations for determining common user directories. In normal usage this module will always be used via
File::HomeDir.
SUPPORT
See the support section the main File::HomeDir module.
AUTHORS
Adam Kennedy <adamk@cpan.org>
Sean M. Burke <sburke@cpan.org>
SEE ALSO
File::HomeDir, File::HomeDir::Win32 (legacy)
COPYRIGHT
Copyright 2005 - 2011 Adam Kennedy.
Some parts copyright 2000 Sean M. Burke.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module.
perl v5.16.3 2012-10-19 File::HomeDir::Unix(3)