View Single Post
Old 02-29-2004, 06:45 PM  
swedguy
Confirmed User
 
Industry Role:
Join Date: Jan 2002
Posts: 7,981
Strip one line comments:

cat file.php | perl -pe 's/^\/\/.*$// > file2.php

file2.php will now be stripped from one line comments



Strip multi line comments:

cat file2.pp | perl -pe '$/ = ""; s/\/\*.*?\*\///sm' > file3.php

file3.php will now be without multi line comments



Strip blank lines:

cat file3.php | perl -pe 's/^\s+//' > file4.php

file4.php will now be stripped from blank lines



A quick and dirty one
swedguy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote