View Single Post

  #2 (permalink)  
Old 05-02-2008, 03:21 AM
rockdalinux's Avatar
rockdalinux rockdalinux is offline
Contributors
User
 
Join Date: May 2005
Location: Bangalore
My distro: RHEL, HP-UX, Solaris, FreeBSD, Ubuntu
Posts: 581
Rep Power: 7
rockdalinux is a jewel in the rough rockdalinux is a jewel in the rough rockdalinux is a jewel in the rough rockdalinux is a jewel in the rough
Default

You can always use sed to remove all blanks and all leading, trailing whitespace and tabs:
Code:
cat filename | sed '/^$/d;s/^[ \t]*//;s/[ \t]*$//'
cat filename | sed '/^$/d;s/^[ \t]*//;s/[ \t]*$//' > new.filename.txt
Here is your output for php:
PHP Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Upgrading to Pivot 1.40: checking for changes..</title>
</head>
<body>
<h1>Upgrading to blabla for changes..</h1>
<p><em>Version 1.6</em></p>
<p>From blabla other things. </p>
<p>This simple script checks if you've made the required change backup it first. You never know when you might need it. </p>
<p><strong>Note:</strong> Make sure this file is in your <tt>pivot/</tt> folder. Otherwise it'll give incorrect results!</p>
<?php
if (!file_exists(dirname(__FILE__)."/pv_core.php")) {
die(
"<strong>This script should be placed in your Pivot directory.</strong>");
}
include_once(
"pvlib.php");
load_all_templates();
echo 
"<h2>Getting rid of miscellaneous old unused files/directories</h2>";
$filestocheck = array(
"./includes/calendar.php"
);
foreach (
$filestocheck as $filetocheck) {
if (
filepresent($filetocheck)) {
warn("The file <tt>$filetocheck</tt> is still present. You should remove it.");
} else {
pass("The file <tt>$filetocheck</tt> is not present.");
}
}
__________________
Rocky Jr.
You may have my body & soul, but you will never touch my pride!

If you have knowledge, let others light their candles at it.

Certified to work on HP-UX / Sun Solaris / RedHat

Last edited by rockdalinux; 05-02-2008 at 03:23 AM..
Reply With Quote