Batch file content replace from template.php


/ Published in: Bash
Save to your folder(s)

Find and replace contents of files ending in .php with nothing. then append contents of template.php to all files in directory


Copy this code and paste it in your HTML
  1. // find and replace all characters with nothing in files ending in .php
  2. perl -pi -w -e 's/.//g;' *.php
  3.  
  4. // find and replace all line breaks with nothing in files ending in .php
  5. perl -pi -w -e 's/\n//g;' *.php
  6.  
  7. // append contents of template.php to every file in directory
  8. for f in *; do cat ../template.php >> "$f"; done

Report this snippet


Comments


You need to login to view comments.