Re: Text Manipulation

2011-02-07 Thread Shlomi Fish
Hi John, On Monday 07 Feb 2011 16:18:32 John Delacour wrote: > At 14:22 +0200 07/02/2011, Shlomi Fish wrote: > >Hi John, > > > >a few comments on your code. > > > > > >Actually, see perldoc perlrun - http://perldoc.perl.org/perlrun.html - by > >giving -p and -i (untested) you can replace the conte

Re: Text Manipulation

2011-02-07 Thread John Delacour
At 14:22 +0200 07/02/2011, Shlomi Fish wrote: Hi John, a few comments on your code. Actually, see perldoc perlrun - http://perldoc.perl.org/perlrun.html - by giving -p and -i (untested) you can replace the contents of a file "in-place". untested?! Why don't you test it before recommending

Re: Text Manipulation

2011-02-07 Thread Shlomi Fish
Hi John, a few comments on your code. On Monday 07 Feb 2011 13:50:57 John Delacour wrote: > At 07:11 -0800 05/02/2011, zavierz wrote: > >Here's code which was suggested to me, but when I execute it I'm > >returned to the command line and nothing happens: > > > >#!/usr/bin/perl > >s/^(Article\s+[0

Re: Text Manipulation

2011-02-07 Thread John Delacour
At 07:11 -0800 05/02/2011, zavierz wrote: Here's code which was suggested to me, but when I execute it I'm returned to the command line and nothing happens: #!/usr/bin/perl s/^(Article\s+[0-9]+\s+\N*\S)/\\subsection*{$1}/gm I called this script "Article" and saved it as article.pl The usa

Re: Text Manipulation

2011-02-06 Thread Rob Dixon
On 05/02/2011 15:11, zavierz wrote: Hi, I am trying to modify a LaTex file which is plain text. The file contains lines similar to the following, but each line is followed by text, so that: Article 1 Cats Article 2 Dogs Article 3 Fish Article 4 Ferrets etc. I would like to modify the file

Re: Text Manipulation

2011-02-06 Thread C.DeRykus
On Feb 5, 7:11 am, zavi...@gmail.com (zavierz) wrote: > Hi, I am trying to modify a LaTex file which is plain text. > The file contains lines similar to the following, but each line is > followed by text, so that: > > Article 1  Cats > Article 2  Dogs > Article 3  Fish > Article 4  Ferrets > > etc.

Re: Text Manipulation

2011-02-06 Thread Dr.Ruud
On 2011-02-06 16:52, mani kandan wrote: $I=~s/^(Article\s+[0-9]+\s+[\A-Z_a-z]+\S)/\\subsection*{$1}/g; print "$I"; That is weird advice in many ways: 1. A variable $I, what is it? Why capital? 2. No spaces around '=~', why? 3. You took out the m-modifier, why? (now it will only match (and

Re: Text Manipulation

2011-02-06 Thread Dr.Ruud
On 2011-02-05 16:11, zavierz wrote: s/^(Article\s+[0-9]+\s+\N*\S)/\\subsection*{$1}/gm Simplified: s/^( Article \s+ [0-9]+ .* \S ) /\\subsection*{$1}/gmx; -- Ruud -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://l

Re: Text Manipulation

2011-02-06 Thread mani kandan
Dear zavierz probably you can try this $I=~s/^(Article\s+[0-9]+\s+[\A-Z_a-z]+\S)/\\subsection*{$1}/g; print "$I"; --- On Sat, 5/2/11, zavierz wrote: From: zavierz Subject: Text Manipulation To: beginners@perl.org Date: Saturday, 5 February, 2011, 8:41 PM Hi, I am trying to modify a

Text Manipulation

2011-02-06 Thread zavierz
Hi, I am trying to modify a LaTex file which is plain text. The file contains lines similar to the following, but each line is followed by text, so that: Article 1 Cats Article 2 Dogs Article 3 Fish Article 4 Ferrets etc. I would like to modify the file so that each referenced line is change

Re: Text manipulation

2006-05-09 Thread D. Bolliger
Per Larsson am Dienstag, 9. Mai 2006 17.50: > Thank you, that solved the problem, but only partly I'm afraid. Problem > is that the lines need to be formatted in a certain way, so that one > line looks exactly like this: > ATOM 1 N ALA 1 41.744 64.901 30.842 1.00 47.38 > 2CDV 8

Re: Text manipulation

2006-05-09 Thread Per Larsson
Thank you, that solved the problem, but only partly I'm afraid. Problem is that the lines need to be formatted in a certain way, so that one line looks exactly like this: ATOM 1 N ALA 1 41.744 64.901 30.842 1.00 47.38 2CDV 83 Is there a way to combine the code below w

Re: Text manipulation

2006-05-09 Thread Chas Owens
On 5/9/06, Per Larsson <[EMAIL PROTECTED]> wrote: snip ie. get everything that is sitting between two ATOM-identifiers to occur on the same line. How can I achieve this? As always, TMTOWTDI: You can set the input record separator use strict; use warnings; { local $/ = 'ATOM\n'; <>; #throw awa

Text manipulation

2006-05-09 Thread Per Larsson
Hello, I have a question about doing the following in perl: I have a file (a protein pdb file) thatt, for various (and unchangeable) reasons look like this: ATOM 1 N ALA 1 41.744 64.901 30.842 1.00 47.38 2CDV 83 ATOM 2 CA ALA 1 41.676 63.465 31.165 1.00 47.22 2CDV 84 ...and so on. What I woul

Re: Help required.....about string/text manipulation

2003-06-15 Thread Rob Dixon
Anybody? Rob Chinku Simon wrote: > > > Mohit_jain01 wrote: > > > > > > > From: Rob Dixon > > > > > > > > Mohit_jain01 wrote: > > > > > > > > > > I am facing a problem with text file manipulation with Perl. > > > > > > > > > > I have a file with over 2 lac lines of data. > > > > > I need to find

Re: Help required.....about string/text manipulation

2003-06-14 Thread Chinku Simon
Hi, I wud like some help in assembling the kit. Thanks in Advance --- Rob Dixon <[EMAIL PROTECTED]> wrote: > Mohit_jain01 wrote: > > > > > From: Rob Dixon > > > > > > Mohit_jain01 wrote: > > > > > > > > I am facing a problem with text file manipulation with Perl. > > > > > > > > I have a file wi

Re: Help required.....about string/text manipulation

2003-06-14 Thread Rob Dixon
Mohit_jain01 wrote: > > > From: Rob Dixon > > > > Mohit_jain01 wrote: > > > > > > I am facing a problem with text file manipulation with Perl. > > > > > > I have a file with over 2 lac lines of data. > > > I need to find the duplicates(strings) in the file and copy those records into > > > another

RE: Help required.....about string/text manipulation

2003-06-13 Thread Mohit_Jain01
, Mohit -Original Message- From: Rob Dixon [mailto:[EMAIL PROTECTED] Sent: Sat 6/14/2003 3:39 AM To: [EMAIL PROTECTED] Cc: Subject: Re: Help required.about string/text manipulation Mohit_jain01 wrote

Re: Help required.....about string/text manipulation

2003-06-13 Thread Rob Dixon
Mohit_jain01 wrote: > Hi, > > I am facing a problem with text file manipulation with Perl. > > I have a file with over 2 lac lines of data. > I need to find the duplicates(strings) in the file and copy those records into > another file. > > Is there a function/module in Perl by which I can read t

Help required.....about string/text manipulation

2003-06-13 Thread Mohit_Jain01
Hi, I am facing a problem with text file manipulation with Perl. I have a file with over 2 lac lines of data. I need to find the duplicates(strings) in the file and copy those records into another file. Is there a function/module in Perl by which I can read the duplicates in a file at one

Re: text manipulation scenario...

2003-02-06 Thread John W. Krahn
Patricia E Gorden-Ozgul wrote: > > I need to construct a working printf statement where each field in a given > record would print at a specified position. > > Each record may or may not contain any particular field but will always > begin with .VENDOR.LIBRARY. and end with .VENDOR.XINFO.END. >

Re: text manipulation scenario...

2003-02-06 Thread Rob Dixon
Patricia E Gorden-Ozgul wrote: > I need to construct a working printf statement where each field in a > given record would print at a specified position. Hi Pat. I've been amusing myself with your problem for an hour or so, and although I don't in general approve of handing out ready-made solutio

RE: text manipulation scenario...

2003-02-06 Thread Wagner, David --- Senior Programmer Analyst --- WGO
Gorden-Ozgul, Patricia E wrote: > I need to construct a working printf statement where each field in a > given record > would print at a specified position. > > Each record may or may not contain any particular field but will > always begin with .VENDOR.LIBRARY. and end with .VENDOR.XINFO.END. >

text manipulation scenario...

2003-02-06 Thread Gorden-Ozgul, Patricia E
I need to construct a working printf statement where each field in a given record would print at a specified position. Each record may or may not contain any particular field but will always begin with .VENDOR.LIBRARY. and end with .VENDOR.XINFO.END. Hope springs eternal for this novice perl scri

Re: Text manipulation

2002-05-30 Thread drieux
On Thursday, May 30, 2002, at 01:13 , Jakob Kofoed wrote: > format STDOUT = > @>> @> @> @> @> @>> > $$a,$b,$c,$d,$e,$f well ok, so to cheat I had to do perldoc -f write perldoc -f format since I have not done this in so long

Re: Text manipulation

2002-05-30 Thread Janek Schleicher
Jakob Kofoed wrote at Thu, 30 May 2002 22:13:42 +0200: Sorry, I don't know enough of the format command to help. But that seems to be a little bit long. > print "Enter Path DATA file .. \n"; > chop($file = ); > > print " \n"; > print "Enter DATA1 ... "; > chop($data1 = ); > > p

Text manipulation

2002-05-30 Thread Jakob Kofoed
Hi, I have a problem using the "format STDOUT =" in a Perl script. The script takes a six columns data file - puts header on top of the data (with different input - variables defined manually). The script write the input to the screen but not a file - I have tried but can only get the data and