ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lee, Michael.M" <Michael.M....@westgroup.com>
Subject RE: Removing whitespace in the code
Date Wed, 26 Feb 2003 17:35:27 GMT
I was trying to run this command.
  perl -p0e 'y/ //s' <src_file.html >dst_file.html

but i'm getting this error now.

can't find string terminator "'"  anywhere before EOF at -e line 1.

do you know what this means?

thanks.

Michael.
-----Original Message-----
From: Craig Berry [mailto:Craig.Berry@portblue.com]
Sent: Tuesday, February 25, 2003 5:40 PM
To: Ant Users List
Subject: RE: Removing whitespace in the code


> Here is an equivalent expression (PERL Golf):
>
> perl -p0e 's/\s\s+/ /sg' < src_file.html > dst_file.html

You can knock one off the perl-golf score by omitting the /s qualifier on
the substitution; /s only changes the interpretation of the . match to
include \n, and your pattern includes no dots.

However, you can really score big (small?) by doing this instead, if you're
actually only interested in spaces rather than all white space:

  perl -p0e 'y/ //s' <src_file.html >dst_file.html

> Since the code reduces the entire file to one line, either of these
solutions are
> not good for JSP files with scriptlets (line comments suddenly make
portions of
> your code commented out.)

Which is one good reason for only going after spaces (and possibly tabs)
rather than all white space.

-- 
Craig Berry
Principal Architect and Technical Manager
PortBlue
(310) 566-7546
 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org

Mime
View raw message