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 LaTex file

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

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. >

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