05-20-2009
vi Search for text, Replace with <CR> or control character.
Greetings,
Using vi, how can I change the following text:
-I/myviews/nexus_7400rel/vobs/nexus/platforms/97400/include -I/myviews/nexus_7400rel/vobs/nexus/modules/i2c/7400/include -I/myviews/nexus_7400rel/vobs/nexus/modules/surface/7400/include
Into this:
/myviews/nexus_7400rel/vobs/nexus/platforms/97400/include
/myviews/nexus_7400rel/vobs/nexus/modules/i2c/7400/include
/myviews/nexus_7400rel/vobs/nexus/modules/surface/7400/include
The first text is a contiguous string with spaces and "-I" separating the lines of include paths (yes, this is from a "C" makefile output).
I want to search for all the occurances of " -I", and replace with a carriage return (or linefeed) using vi. This is for vi on a Linux system.
The search portion is easy: :g/ -I/s// (what goes here?)/g
It's the "what goes here?" part that I need help with.
Any answers or alternative solutions would be greatly appreciated.
Omega949
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi All,
I have a file that I need to be able to find a pattern match on a line, search that line for a text pattern, and replace that text.
An example of 4 lines in my file is:
1. MatchText_randomNumberOfText moreData ReplaceMe moreData
2. MatchText_randomNumberOfText moreData moreData... (4 Replies)
Discussion started by: Crypto
4 Replies
2. UNIX for Dummies Questions & Answers
I have a text file with following content (3 lines)
filename : output.txt
first line:12/12/2008
second line:12/12/2008
third line:Y
I would like to know how we can replace 'Y' with 'N' in the 3rd line keeping 1st and 2nd lines same as what it was before.
I tried using cat output.txt... (4 Replies)
Discussion started by: santosham
4 Replies
3. Shell Programming and Scripting
Hi,
I wanted to add a newline character after every 100 characters in a file using a awk or shell without reading each line of the file.
I want to run a command on the complete file.
This does based on a string but i want to add a new line after every 100 characters ir-respective of the... (3 Replies)
Discussion started by: vijaykrc
3 Replies
4. Shell Programming and Scripting
Need to replace any control character in the string in perl
---------- Post updated at 04:22 PM ---------- Previous update was at 03:50 PM ----------
Any help !!!
Thanks in advance (2 Replies)
Discussion started by: hansini
2 Replies
5. Shell Programming and Scripting
Hello,
I am trying to search and replace but I don't know how to do it. My simple knowlegde in search and replace using sed is not helping me at all.
File:
its a cause value #22: dfg ggg
Cause value #1: aasfa fasdf
asfa value #22: affg gggg
Basically i want to replace the... (6 Replies)
Discussion started by: balan1983a
6 Replies
6. Shell Programming and Scripting
Hi
Input:
-
--
---
----
aa-bb-cc
aa--bb--cc
aa---bb---cc
aa----bb----cc
Output:
.
-
-.
--
aa.bb.cc (7 Replies)
Discussion started by: chitech
7 Replies
7. Shell Programming and Scripting
Hi All,
We are getting an external file in abc.csv format. When opened in excel spread sheet, it is opening alright. But when opened in notepad, I see the contents in a single line.
Ftp'd the file in binary mode to AIX UNIX host. When opened, I see Control M (^M) characters in place of New Line... (16 Replies)
Discussion started by: njny
16 Replies
8. UNIX for Dummies Questions & Answers
Hi Unix gurus,
I've a dna sequence in a file format known as fasta format (sequence header starts with > and ignored), an example shown below:
>sequence_1
CGTATTCTCCGAATACC
ATACG
>sequence_2
CAGATTTTCAAATACCCCC
In a file like this I want to do the following three search and replace. The... (4 Replies)
Discussion started by: Fahmida
4 Replies
9. Shell Programming and Scripting
This is for AIX 6.1, I've a flat file and the format is like this
DECLARE
some statements;
BEGIN
some statements;
END;
I've to search BEGIN and replace it with the following 4 lines
BEGIN
For x in 1..1
LOOP
BEGIN
Similarly I've to search END and replace it with the... (7 Replies)
Discussion started by: Mukul Sharma
7 Replies
10. Post Here to Contact Site Administrators and Moderators
In file, we have millions of records each of 1000 in length. And at specific position say 800 there is a space, we need to replace it with Character X if the ID in that row starts with 123.
So far i have used the below which is replacing space at that position to X but its not checking for... (3 Replies)
Discussion started by: Jagmeet Singh
3 Replies
LEARN ABOUT DEBIAN
bio::alignio::nexus
Bio::AlignIO::nexus(3pm) User Contributed Perl Documentation Bio::AlignIO::nexus(3pm)
NAME
Bio::AlignIO::nexus - NEXUS format sequence input/output stream
SYNOPSIS
Do not use this module directly. Use it via the Bio::AlignIO class.
use Bio::AlignIO;
my $in = Bio::AlignIO->new(-format => 'nexus',
-file => 'aln.nexus');
while( my $aln = $in->next_aln ) {
# do something with the alignment
}
DESCRIPTION
This object can transform Bio::Align::AlignI objects to and from NEXUS data blocks. See method documentation for supported NEXUS features.
ACKNOWLEDGEMENTS
Will Fisher has written an excellent standalone NEXUS format parser in Perl, readnexus. A number of tricks were adapted from it.
FEEDBACK
Support
Please direct usage questions or support issues to the mailing list:
bioperl-l@bioperl.org
rather than to the module maintainer directly. Many experienced and reponsive experts will be able look at the problem and quickly address
it. Please include a thorough description of the problem with code and data examples if at all possible.
Reporting Bugs
Report bugs to the Bioperl bug tracking system to help us keep track the bugs and their resolution. Bug reports can be submitted via the
web:
https://redmine.open-bio.org/projects/bioperl/
AUTHORS - Heikki Lehvaslaiho
Email: heikki-at-bioperl-dot-org
APPENDIX
The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _
new
Title : new
Usage : $alignio = Bio::AlignIO->new(-format => 'nexus', -file => 'filename');
Function: returns a new Bio::AlignIO object to handle clustalw files
Returns : Bio::AlignIO::clustalw object
Args : -verbose => verbosity setting (-1,0,1,2)
-file => name of file to read in or with ">" - writeout
-fh => alternative to -file param - provide a filehandle
to read from/write to
-format => type of Alignment Format to process or produce
Customization of nexus flavor output
-show_symbols => print the symbols="ATGC" in the data definition
(MrBayes does not like this)
boolean [default is 1]
-show_endblock => print an 'endblock;' at the end of the data
(MyBayes does not like this)
boolean [default is 1]
next_aln
Title : next_aln
Usage : $aln = $stream->next_aln()
Function: Returns the next alignment in the stream.
Supports the following NEXUS format features:
- The file has to start with '#NEXUS'
- Reads in the name of the alignment from a comment
(anything after 'TITLE: ') .
- Sequence names can be given in a taxa block, too.
- If matchchar notation is used, converts
them back to sequence characters.
- Does character conversions specified in the
NEXUS equate command.
- Sequence names of type 'Homo sapiens' and
Homo_sapiens are treated identically.
Returns : L<Bio::Align::AlignI> object
Args :
write_aln
Title : write_aln
Usage : $stream->write_aln(@aln)
Function: Writes the $aln object into the stream in interleaved NEXUS
format. Everything is written into a data block.
SimpleAlign methods match_char, missing_char and gap_char must be set
if you want to see them in the output.
Returns : 1 for success and 0 for error
Args : L<Bio::Align::AlignI> object
flag
Title : flag
Usage : $obj->flag($name,$value)
Function: Get/Set a flag value
Returns : value of flag (a scalar)
Args : on set, new value (a scalar or undef, optional)
perl v5.14.2 2012-03-02 Bio::AlignIO::nexus(3pm)