I am trying to convert the encoding of a bunch of php files scattered over several subdirectories. (a Postnuke language pack) For the recoding part I planned to use htmlrecode, which I had been using before on files in
one directory.
Since I had problems getting along with the piping (htmlrecode reads and writes to standard in/output), the author was so kind to help me with a small script for all files in one directory:
Code:
#!/bin/bash
mkdir o
for s in *.html; do
htmlrecode -IBIG5 -OUTF-8 < "$s" > o/"$s"
done
This will put the recoded files into a new subdirectory. This time however I had to modify files in many subdirectories, and I must modify the original file, not just copy a recoded version somewhere. So I tried this, inspired by another problem's solution:
Code:
find /directory_name -name *.php | htmlrecode -OUTF8
All php files were listed, but none was recoded. I admit I am pretty weak at pipes (never smoked), so some people will probably laugh seeing my obvious mistake. My personal guess is that htmlrecode does not get anything piped in (and out), but I cannot find a solution for this problem and would be grateful for a helpful answer...