[CentOS] perl code to remove newlines

2010-12-30 Thread ken
Given an HTML file which looks like this: - begin snippet - HTML HEAD TITLE We've Lied to You#8230;/TITLE META NAME=GENERATOR CONTENT=Modular DocBook HTML Stylesheet Version 1.79LINK REL=HOME TITLE=Maximum RPM HREF=index.htmlLINK REL=UP TITLE=Using RPM to Verify Installed

Re: [CentOS] perl code to remove newlines

2010-12-30 Thread Bowie Bailey
On 12/30/2010 8:19 AM, ken wrote: Given an HTML file which looks like this: - begin snippet - HTML HEAD TITLE We've Lied to You#8230;/TITLE META NAME=GENERATOR CONTENT=Modular DocBook HTML Stylesheet Version 1.79LINK REL=HOME TITLE=Maximum RPM HREF=index.htmlLINK

Re: [CentOS] perl code to remove newlines

2010-12-30 Thread ken
On 12/30/2010 09:18 AM Bowie Bailey wrote: On 12/30/2010 8:19 AM, ken wrote: Given an HTML file which looks like this: - begin snippet - HTML HEAD TITLE We've Lied to You#8230;/TITLE META NAME=GENERATOR CONTENT=Modular DocBook HTML Stylesheet Version 1.79LINK REL=HOME

Re: [CentOS] perl code to remove newlines

2010-12-30 Thread John Doe
From: ken geb...@mousecar.com Some file this script would need to process could very well be ridiculously huge, which is why I chose to process line-by-line. Secondly, yes, I was already using the general strategy of taking out the newlines (where they're misplaced) and then putting them

Re: [CentOS] perl code to remove newlines

2010-12-30 Thread Bowie Bailey
On 12/30/2010 10:24 AM, ken wrote: On 12/30/2010 09:18 AM Bowie Bailey wrote: On 12/30/2010 8:19 AM, ken wrote: Given an HTML file which looks like this: - begin snippet - HTML HEAD TITLE We've Lied to You#8230;/TITLE META NAME=GENERATOR CONTENT=Modular DocBook HTML

Re: [CentOS] perl code to remove newlines

2010-12-30 Thread Sean
Not sure exactly what you are trying to do, but Tie::File might be worth a look at if you haven't done so already? Sean ken wrote: Given an HTML file which looks like this: - begin snippet - HTML HEAD TITLE We've Lied to You#8230;/TITLE META NAME=GENERATOR

Re: [CentOS] perl code to remove newlines

2010-12-30 Thread cpolish
John Doe wrote: $ cat $FILE | tr \n | sed 's/ */\n/g' I was yearning for someone to chime with that! sed is clearly the best most straightforward way to do this task. I can't help myself - there's a useless use of cat: $ $FILE tr \n | sed 's/ */\n/g'

Re: [CentOS] perl code to remove newlines

2010-12-30 Thread ken
On 12/30/2010 11:01 AM John Doe wrote: From: ken geb...@mousecar.com Some file this script would need to process could very well be ridiculously huge, which is why I chose to process line-by-line. Secondly, yes, I was already using the general strategy of taking out the newlines (where

Re: [CentOS] perl code to remove newlines

2010-12-30 Thread Jerry McAllister
On Thu, Dec 30, 2010 at 08:19:00AM -0500, ken wrote: It isn't perl, but does 'tr' exist in CentOS (it does in FreeBSD)? It would do it. jerry Given an HTML file which looks like this: - begin snippet - HTML HEAD TITLE We've Lied to You#8230;/TITLE META

Re: [CentOS] perl code to remove newlines

2010-12-30 Thread Bart Schaefer
On Thu, Dec 30, 2010 at 5:19 AM, ken geb...@mousecar.com wrote: - begin snippet - while ($in) {    s/(\w*\W)/\L$1/g;         # Downcase XXX in XXX.    s/\/(\w*\W)/\/\L$1/g;     # Downcase XXX in /XXX. chomp; # Always remove the newline unless (/html/) { # Not on first

Re: [CentOS] perl code to remove newlines

2010-12-30 Thread Bart Schaefer
(Drat, keyboard glitch caused that to be sent before I was finished.) On Thu, Dec 30, 2010 at 5:19 AM, ken geb...@mousecar.com wrote: - begin snippet - while ($in) {    s/(\w*\W)/\L$1/g;         # Downcase XXX in XXX.    s/\/(\w*\W)/\/\L$1/g;     # Downcase XXX in /XXX.

Re: [CentOS] perl code to remove newlines

2010-12-30 Thread Bart Schaefer
Oops again, typo:      s/^(^[])/\n$1/; Should be s/^([^])/\n$1/ ___ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos