using perl for matching one file with another file and print into new line
One file is fileA
0.0246*0.0068*0.0013*0.0023*0.0182*0.0028*0.0019*0.4750*0.0028*0.0812*0.0123*0.0018*0.0039*0.0020*0. 0028*0.0047*0.0139*0.3330*0.0017*0.0072*0.4789 0.0234*0.0062*0.0013*0.0023*0.0214*0.0027*0.0021*0.2783*0.0029*0.2001*0.0141*0.0017*0.0037*0.0021*0. 0030*0.0045*0.0124*0.4077*0.0019*0.0081*0.5228 0.0156*0.0045*0.0044*0.0075*0.0132*0.0037*0.0109*0.1374*0.0091*0.0489*0.5817*0.0082*0.0038*0.0765*0. 0141*0.0081*0.0110*0.0288*0.0034*0.0092*0.5426
Second file is file B
I85V
L95I
I103M
So using perl, i want to get the output
I=0.4750 V=0.0017 L=0.2001 I=0.0214 I=0.1374 M=0.5817
So so for symbols having A=1,C=2,D=3,E=4,F=5,G=6,H=7,I=8.K=9,L=10,M=11,N=12,P=13,Q=14,R=15,S=16,T=17,V=18,W=19,Y=20
writing perl using Switch command..
can u further how can i do it...
Code:
#!/usr/bin/perl -w
use Switch;
print "PLEASE ENTER THE FILENAME OF THE FILE:=";
chomp($prot_psap=<STDIN>);
open(PROTFILE,$prot_psap) or die "unable to open the file";
@prot=<PROTFILE>;
close PROTFILE;
foreach $line (@prot) {
#$line ="s/*//g";
if ($line =~ s/^>//g) {
next;
}
else {
$sequence = $line;
}
$sequence =~ s/\*/ /g;
@prota=split('',$sequence);
print @prota;
}
print "PLEASE ENTER THE FILENAME OF THE FILE:=";
chomp($mutation_file=<STDIN>);
open(MUTFILE,$mutation_file) or die "unable to open the file";
@mut=<MUTFILE>;
close MUTFILE;
foreach $line (@mut) {
if ($line =~ s/^>//g) {
next;
}
else {
$mutation = $line;
#$i=0;
}
$mutation =~ s/[^A-Z]/ /g;
@muta= split('',$mutation);
print @muta,"\n";
}
Hi,
I haven't done this for awhile, and further, I've never done it in perl so I appreciate any help you can give me.
I have a file of lines, each with 5 data points that look like this:
AB,N,ALLIANCEBERNSTEIN HLDNG L.P,AB,N
ALD,N,ALLIED CAPITAL CORPORATION,ALD,N
AFC,N,ALLIED CAPITAL... (4 Replies)
Hello everyone,
I have a little script below:
die "Usage infile outfile reGex" if @ARGV != 3;
($regex) = @ARGV;
open(F,$ARGV) or die "Can't open";
open(FOUT,"+>$ARGV") or die "Can't open";
while (<F>)
{
print FOUT if /$regex/.../$regex/;
}
No matter what I give $regex on the... (2 Replies)
Hi Experts,
I am very new to scripting and have a prb since few days and it is urgent to solve so much appreciated if u help me.
i have 2 files
file1.txt
9647810043118
9647810043126
9647810043155
9647810043161
9647810043166
9647810043185
9647810043200
9647810043203
9647810043250... (22 Replies)
Hi
I am not the best scripter in the world and have run into a issue which you might be able to guide me on...
I have two files.
File1 :
A123, valueA, valueB
B234, valueA, valueB
C345, valueA, valueB
D456, valueA, valueB
E567, valueA, valueB
F678, valueA, valueB
File2:
C345,... (5 Replies)
Hi,
I want to achieve something similar to what described in another post:
The difference is I want to add the line if the pattern is not found.
File 1:
A123, valueA, valueB
B234, valueA, valueB
C345, valueA, valueB
D456, valueA, valueB
E567, valueA, valueB
F678, valueA, valueB
... (11 Replies)
HI
Can any one guide me how to achieve this task. I have 2 files
env.txt
#Configuration.Properties values
identity_server_url = http://identity.test-hit.com:9783/identity/service/user/register
randon_password_length = 6
attachment_file_path = /pass/temp/attachments/... (1 Reply)
Hello,
I have two files file 1 and file 2 each having result of a query on certain database tables and need to compare for Col1 in file1 with Col3 in file2, compare Col2 with Col4 and output the value of Col1 from File1 which is a) not present in Col3 of File2 b) value of Col2 is different from... (2 Replies)
The bash bash below extracts the oldest folder from a directory and stores it in filename
That result will match a line in bold in input. In the matching line there is an_xxx digit in italics that
(once the leading zero is removed) will match a line in link. That is the lint to print in output.... (2 Replies)
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
LEARN ABOUT CENTOS
set_color
set_color(1) fish set_color(1)NAME
set_color - set_color - set the terminal color
set_color - set the terminal color
Synopsis
set_color [-v --version] [-h --help] [-b --background COLOR] [COLOR]
Description
Change the foreground and/or background color of the terminal. COLOR is one of black, red, green, brown, yellow, blue, magenta, purple,
cyan, white and normal.
o -b, --background Set the background color
o -c, --print-colors Prints a list of all valid color names
o -h, --help Display help message and exit
o -o, --bold Set bold or extra bright mode
o -u, --underline Set underlined mode
o -v, --version Display version and exit
Calling set_color normal will set the terminal color to whatever is the default color of the terminal.
Some terminals use the --bold escape sequence to switch to a brighter color set. On such terminals, set_color white will result in a grey
font color, while set_color --bold white will result in a white font color.
Not all terminal emulators support all these features. This is not a bug in set_color but a missing feature in the terminal emulator.
set_color uses the terminfo database to look up how to change terminal colors on whatever terminal is in use. Some systems have old and
incomplete terminfo databases, and may lack color information for terminals that support it. Download and install the latest version of
ncurses and recompile fish against it in order to fix this issue.
Version 1.23.1 Sun Jan 8 2012 set_color(1)