Sponsored Content
Top Forums Shell Programming and Scripting Help with replace data content Post 302576500 by cpp_beginner on Friday 25th of November 2011 04:59:09 AM
Old 11-25-2011
Help with replace data content

Format of one input file:
Code:
# >length=1
seq	program	data	909	1992
seq	program	record	909	1190

Desired output result:
Code:
# >length=1
length=1	program	data	909	1992
length=1	program	record	909	1190

I wanna to replace all the column 1 content (exclude the content start with "#") with the info in # but remove the ">"
Command I try:
Code:
step 1:
awk '{print $2}' input_file.txt | fgrep '>' | sed 's/>//g' > tmp.txt
cat
step 2:
cat tmp.txt | awk '{print "sed \047s/seq/"$1"/g\047 input_file.txt"}' > run.sh
step 3:
./run.sh

The command I try is also able to generate my desired output result.
Thanks for any advice to improve it.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to replace a variable content

Hi, variable1="This is a car" Now I want to replace the content of variable1, "car" to "dog". Is there any simple command I can use. Thanks. Joseph (4 Replies)
Discussion started by: josephwong
4 Replies

2. Shell Programming and Scripting

How to replace a line content

Hi Experts, I have binary files contain an ID Line as: : : $Header: FNDSCMON.fmb 115.6 2000/01/11 10:26:10 pkm ship$ : : where the ID Line format is: $Header: <File_Name> <Version> <Last_update_date_time> pkm ship$ In this Example: File_Name = FNDSCMON.fmb Version = 115.6... (13 Replies)
Discussion started by: victorcheung
13 Replies

3. Shell Programming and Scripting

search and replace the content

Hi All,sorry for inconvience....please find the attachement for my question i am unable to paste the question here....please help me in slving thisthanksk.k (4 Replies)
Discussion started by: G.K.K
4 Replies

4. Shell Programming and Scripting

Extract specific data content from a long list of data

My input: Data name: ABC001 Data length: 1000 Detail info Data Direction Start_time End_time Length 1 forward 10 100 90 1 forward 15 200 185 2 reverse 50 500 450 Data name: XFG110 Data length: 100 Detail info Data Direction Start_time End_time Length 1 forward 50 100 50 ... (11 Replies)
Discussion started by: patrick87
11 Replies

5. Shell Programming and Scripting

Replace data of one column with data on other file corresponding to transaction ID matched

Hi All, I have two files one of which having some mobile numbers and corresponding value whose sample content as follows: 9058629605,8.0 9122828964,30.0 And in second file complete details of all mobile numbers and sample content as follows and delimeter used is comma(,): ... (8 Replies)
Discussion started by: poweroflinux
8 Replies

6. Shell Programming and Scripting

Help with replace duplicate content

Input file: CCNI data564_input1 264 CORO1A data564_input2 155 ABC-B data17_input1 3466 ABC-B data17_input2 1133 ABC-B data17_input3 2162 ABC-B data17_input4 2019 HNRNPA2B1 data95_input1 101 HNRNPA2B1 data95_input2 340 IFITM1 data105_input2 291 IFITM2 data105_input1 505... (3 Replies)
Discussion started by: cpp_beginner
3 Replies

7. Shell Programming and Scripting

Sed: replace content from file with the content from file

Hi, I am having trouble while using 'sed' with reading files. Please help. I have 3 files. File A, file B and file C. I want to find content of file B in file A and replace it by content in file C. Thanks a lot!! Here is a sample of my question. e.g. (file A: a.txt; file B: b.txt; file... (3 Replies)
Discussion started by: dirkaulo
3 Replies

8. Shell Programming and Scripting

Help with replace all the content within ()

Hi, Below is my input file : AAAG(12) TC(14) AACCCT(66) AACCCT(30) AACCCT(18) AACCCT(48) TCTG(12) TCTG(20) TCTG(16) AC(12) AC(12) TCTG(16) TCTG(12) AC(12) AC(12) AC(12) AC(26) AC(14) AGTG(12) AC(24) AGTG(12) TCC(12) Desired output : AAAG TC AACCCT AACCCT AACCCT AACCCT TCTG TCTG... (4 Replies)
Discussion started by: perl_beginner
4 Replies

9. Shell Programming and Scripting

Mysql Content Replace

I have a wordpress site. I need add "post_title" to all my "post_content" mysql field. Thanks. my content: Free <b>Online Tips</b> output:Free post_title <b>Online Tips</b>: This code does not work: UPDATE wp_posts SET post_content = REPLACE ( post_content, 'Free <b>Online... (0 Replies)
Discussion started by: tara123
0 Replies

10. Shell Programming and Scripting

Replace Content

Hello all ; ) I'got a file1 with a lot of emails like : fistname.lastname@domaine1.comAnd another file2 with emails like fistname.lastname@domaine2.ct.netI need a shell script that will read each line from the file1 and try to find if in file2 the fistname.lastname exist. If yes, the... (1 Reply)
Discussion started by: Aswex
1 Replies
Bio::Tools::Run::Alignment::Gmap(3pm)			User Contributed Perl Documentation		     Bio::Tools::Run::Alignment::Gmap(3pm)

NAME
Bio::Tools::Run::Alignment::Gmap - Wrapper for running gmap. SYNOPSIS
use Bio::Tools::Run::Alignment::Gmap; use Bio::SeqIO; my $sio = Bio::SeqIO->new(-file=>$filename ,-format=>'fasta'); my @seq; while(my $seq = $sio->next_seq()){ push @seq,$seq; } my $mapper =Bio::Tools::Run::Gmap->new(); my $result = $mapper->run(@seq); DESCRIPTION
Bioperl-run wrapper around gmap. See <http://www.gene.com/share/gmap/> for information about gmap. It requires a reference to an array of bioperl SeqI objects and returns a reference to a filehandle from which the gmap output can be read. One can explicitly set the name of the genome database (defaults to NHGD_R36) using the 'genome_db()' method. One can also explicitly set the flags that are passed to gmap (defaults to '-f 9 -5 -e') using the 'flags()' method. The name of the gmap executable can be overridden using the program_name() method and the directory in which to find that executable can be overridden using the program_dir() method. 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/wiki/Mailing_lists - 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 the web: http://redmine.open-bio.org/projects/bioperl/ AUTHOR - George Hartzell Email hartzell@alerce.com Describe contact details here CONTRIBUTORS
Additional contributors names and emails here 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::Run::Alignment::Gmap(); Function: Builds a new Bio::Tools::Run::Alignment::Gmap object Returns : an instance of Bio::Tools::Run::Alignment::Gmap Args : version Title : version Usage : print "gmap version: " . $mapper->version() . " "; Function: retrieves and returns the version of the gmap package. Example : Returns : scalar string containing the version number. Probably looks like YYYY-MM-DD. Args : none. program_name Title : program_name Usage : $mapper->program_name('gmap-dev'); my $pname = $mapper->program_name(); Function: sets/gets the name of the program to run. Returns : string representing the name of the executable. Args : [optional] string representing the name of the executable to set. program_dir Title : program_dir Usage : $mapper->program_dir('/usr/local/sandbox/gmap/bin'); my $pdir = $mapper->program_dir(); Function: sets/gets the directory path in which to find the gmap executable. Returns : string representing the path to the directory. Args : [optional] string representing the directory path to set. input_file Title : input_file Usage : $mapper->input_file('/tmp/moose.fasta'); my $filename = $mapper->input_file(); Function: sets/gets the name of a file containing sequences to be mapped. Returns : string containing the name of the query sequence. Args : [optional] string representing the directory path to set. genome_db Title : genome_db Usage : $mapper->genome_db('NHGD_R36'); my $genome_db = $mapper->genome_db(); Function: sets/gets the name of the genome database, this will be passed to gmap using its '-d' flag. Returns : name of the genome database. Args : [optional] string representing the genome db to set. flags Title : flags Usage : $mapper->flags('-A -e -5'); my $flags = $mapper->flags(); Function: sets/gets the flags that will be passed to gmap. Returns : the current value of the flags that will be passed to gmap. Args : [optional] the flags to set. run Title : run Usage : $mapper->run() Function: runs gmap Example : Returns : a file handle, opened for reading, for gmap's output. Args : An array of references query sequences (as Bio::Seq objects) _build_fasta_input_file Title : _build_fasta_input_file Usage : my $seq_file = $self->_build_fasta_input_file(@_); Function: Example : Returns : The name of the temporary file that contains the sequence. Args : A reference to an array of Bio::Seq objects. perl v5.12.3 2011-06-18 Bio::Tools::Run::Alignment::Gmap(3pm)
All times are GMT -4. The time now is 02:53 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy