Sponsored Content
Top Forums Shell Programming and Scripting How to replace the last pattern using sed? Post 302508869 by ctsgnb on Tuesday 29th of March 2011 10:16:12 AM
Old 03-29-2011
So we miss some criteria to answer your question : give more clue

You want to replace which AAA ?

all but not the one in the first line ?

Only the last occurrence of AAA found ?

Only the second occurrence of AAA found ?

other ?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Find a pattern and replace using sed.

Hi I need to help on finding the below pattern using sed <b><a href="/home/document.do?assetkey=x-y-abcde-1&searchclause=photo"> and replace as below in the same line on the index file. <b><a href="/abcde.html"> thx in advance. Mari (5 Replies)
Discussion started by: maridhasan
5 Replies

2. Shell Programming and Scripting

SED Search Pattern and Replace with the Pattern

Hello All, I have a string "CP_STATUS OSSRC_R6_0_Shipment_R1H_CU AOM_901046 R1H_LLSV1_2008031", and I just want to extract LLSV1, but I dont get the expected result when using the sed command below. # echo "CP_STATUS OSSRC_R6_0_Shipment_R1H_CU AOM_901046 R1H_LLSV1_2008031" | awk '{print... (4 Replies)
Discussion started by: racbern
4 Replies

3. Shell Programming and Scripting

Pattern Replace using sed or awk

Hi , My file have data like 4:ALMOST NEVER PR 1925836 5:NEVER PR W DDA 5857610 6:NEVER PR WO DDA 26770205 but i want to replace the spaces before last numric digits out put should be like this 4:ALMOST NEVER PR=1925836 5:NEVER PR W DDA=5857610 6:NEVER PR WO... (7 Replies)
Discussion started by: max_hammer
7 Replies

4. Shell Programming and Scripting

Replace everything but pattern in a line using sed

I have a file with multiple lines like this: <junk><PATTERN><junk><PATTERN><junk> <junk><PATTERN><junk><PATTERN><junk><PATTERN><junk> Note that 1. There might be variable number occurrences of PATTERN in a line. 2. <> are just placeholders, they do not form part of the pattern. I need... (4 Replies)
Discussion started by: flatley
4 Replies

5. Shell Programming and Scripting

sed to replace pattern with filename

Hi all, I'm trying to replace a pattern/string in about 100 files with the filename using following commands but getting nowhere: for f in *.fa; do sed "s/^>.*/>$f/g" $f > $f_v1.fa; done for f in *.fa; do sed 's/^>.*/>`echo $f`/' > $fa_v1.fa; done Basically I want to change any line... (5 Replies)
Discussion started by: ivpz
5 Replies

6. Shell Programming and Scripting

sed command to replace two character pattern with another pattern

Not able to paste my content. Please see the attachment :-( (2 Replies)
Discussion started by: vivek d r
2 Replies

7. Shell Programming and Scripting

sed find/replace a pattern, but not this one..

I've got a file like so: ...lots of lines, etc. push "route 10.8.0.0 255.255.255.0" push "route 192.168.1.123 255.255.255.0" ...lots of lines, etc. I want to sed find/replace the IP address in the second line, whatever it is, with a new IP address, but I don't want to touch the first line.... (5 Replies)
Discussion started by: DaHai
5 Replies

8. Shell Programming and Scripting

sed - Search and replace within pattern

Hi Guys! Unix newbie here! Have a requirement for which I have been scouting the forums for a solution but has been out of luck so far :( I have a file which contains the following:- TEST1|TEST2|"TEST3|1@!2"|TEST5 My sed command should result in either one the following output:-... (6 Replies)
Discussion started by: hishamzz
6 Replies

9. UNIX for Beginners Questions & Answers

sed replace pattern

I have a file with multiple lines, all in the same format. For each line, I need to replace the sequence of digits after the last : with a new value, but keep the single quote at the end of the line. Example: Input: ( two lines of file) Name: 'text1:200/text2:1.2.3.4' Name2:... (19 Replies)
Discussion started by: Beginner101
19 Replies

10. UNIX for Beginners Questions & Answers

Find pattern and replace using sed

Hi, i want to replace the following lines in such a way that if the word merge exists in first column it must replace the 3rd column as M and if parse exists in first column then the last column must P, if neither it must mark it as X. I have tried the solution using awk, but it is saying... (6 Replies)
Discussion started by: charlie87
6 Replies
Bio::Tools::Phylo::PAML::Codeml(3pm)			User Contributed Perl Documentation		      Bio::Tools::Phylo::PAML::Codeml(3pm)

NAME
Bio::Tools::Phylo::PAML::Codeml - Parses output from the PAML program codeml. SYNOPSIS
#!/usr/bin/perl -Tw use strict; use Bio::Tools::Phylo::PAML::Codeml; # need to specify the output file name (or a fh) (defaults to # -file => "codeml.mlc"); also, optionally, the directory in which # the other result files (rst, 2ML.dS, etc) may be found (defaults # to "./") my $parser = new Bio::Tools::Phylo::PAML::Codeml::Parser (-file => "./results/mlc", -dir => "./results/"); # get the first/next result; a Bio::[...]::Codeml::Result object my $result = $parser->next_result(); # get the sequences used in the analysis; returns Bio::PrimarySeq # objects (OTU = Operational Taxonomic Unit). my @otus = $result->get_seqs(); # codon summary: codon usage of each sequence [ arrayref of { # hashref of counts for each codon } for each sequence and the # overall sum ], and positional nucleotide distribution [ arrayref # of { hashref of frequencies for each nucleotide } for each # sequence and overall frequencies ]. my ($codonusage, $ntdist) = $result->get_codon_summary(); # example manipulations of $codonusage and $ntdist: printf "There were %d '%s' codons in the first seq (%s) ", $codonusage->[0]->{AAA}, 'AAA', $otus[0]->id(); printf "There were %d '%s' codons used in all the sequences ", $codonusage->[$#{$codonusage}]->{AAA}, 'AAA'; printf "Nucleotide '%c' was present %g of the time in seq %s ", 'A', $ntdist->[1]->{A}, $otus[1]->id(); # get Nei & Gojobori dN/dS matrix: my $NGmatrix = $result->get_NGmatrix(); # get ML-estimated dN/dS matrix, if calculated; this corresponds to # the runmode = -2, pairwise comparison usage of codeml my $MLmatrix = $result->get_MLmatrix(); # These matrices are length(@otu) x length(@otu) "strict lower # triangle" 2D-matrices, which means that the diagonal and # everything above it is undefined. Each of the defined cells is a # hashref of estimates for "dN", "dS", "omega" (dN/dS ratio), "t", # "S" and "N". If a ML matrix, "lnL" will also be defined. Any # additional ML parameters estimated by the model will be in an # array ref under "params"; it's up to the user to know which # position corresponds to which parameter (since PAML doesn't label # them, and we can't guess very well yet (a TODO I guess). printf "The omega ratio for sequences %s vs %s was: %g ", $otus[0]->id, $otus[1]->id, $MLmatrix->[0]->[1]->{omega}; # with a little work, these matrices could also be passed to # Bio::Tools::Run::Phylip::Neighbor, or other similar tree-building # method that accepts a matrix of "distances" (using the LOWTRI # option): my $distmat = [ map { [ map { $$_{omega} } @$_ ] } @$MLmatrix ]; # for runmode's other than -2, get tree topology with estimated # branch lengths; returns a Bio::Tree::TreeI-based tree object with # added PAML parameters at each node my $tree = $result->get_tree(); for my $node ($tree->get_nodes()) { # inspect the tree: the "t" (time) parameter is available via # $node->branch_length(); all other branch-specific parameters # ("omega", "dN", etc.) are available via $node->param('omega'); } # get any general model parameters: kappa (the # transition/transversion ratio), NSsites model parameters ("p0", # "p1", "w0", "w1", etc.), etc. my $params = $result->get_model_params(); printf "M1 params: p0 = %g p1 = %g ", $params->{p0}, $params->{p1}; # for NSsites models, obtain posterior probabilities for membership # in each class for every position; probabilities correspond to # classes w0, w1, ... etc. my @probs = $result->get_posteriors(); # find, say, positively selected sites! if ($params->{w2} > 1) { for (my $i = 0; $i < @probs ; $i++) { if ($probs[$i]->[2] > 0.5) { # assumes model M1: three w's, w0, w1 and w2 (positive selection) printf "position %d: (%g prob, %g omega, %g mean w) ", $i, $probs[$i]->[2], $params->{w2}, $probs[$i]->[3]; } } } else { print "No positive selection found! "; } DESCRIPTION
This module is used to parse the output from the PAML program codeml. You can use the Bio::Tools::Run::Phylo::Phylo::PAML::Codeml module to actually run codeml; this module is only useful to parse the output. FEEDBACK
Mailing Lists User feedback is an integral part of the evolution of this and other Bioperl modules. Send your comments and suggestions preferably to the Bioperl mailing list. Your participation is much appreciated. bioperl-l@bioperl.org - General discussion http://bioperl.org/MailList.shtml - About the mailing lists Reporting Bugs Report bugs to the Bioperl bug tracking system to help us keep track of the bugs and their resolution. Bug reports can be submitted via email or the web: bioperl-bugs@bioperl.org http://bioperl.org/bioperl-bugs/ AUTHOR - Jason Stajich, Aaron Mackey Email jason@bioperl.org Email amackey@virginia.edu TODO
This module should also be able to handle "codemlsites" batch output... APPENDIX
The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _ new Title : new Usage : my $obj = new Bio::Tools::Phylo::PAML::Codeml(); Function: Builds a new Bio::Tools::Phylo::PAML::Codeml object Returns : Bio::Tools::Phylo::PAML::Codeml Args : get_trees Title : get_trees Usage : my @trees = $codemlparser->get_trees(); Function: Returns a list of trees (if any) are in the output file Returns : List of L<Bio::Tree::TreeI> objects Args : none get_statistics Title : get_statistics Usage : my $data = $codemlparser->get_statistics Function: Retrieves the set of pairwise comparisons Returns : Hash Reference keyed as 'seqname' -> 'seqname' -> 'datatype' Args : none perl v5.14.2 2012-03-02 Bio::Tools::Phylo::PAML::Codeml(3pm)
All times are GMT -4. The time now is 07:57 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy