Remove the first line of multiple files and change its extension

I need to remove the first line of a certain file type from a directory, and all subdirectories. Then change each files extension to the new extension type.

Related tags: Linux

Credit: own experience

Create a new file and paste the following;

#!/bin/bash
for f in `find . -iname *.cgi`
do
echo ${f}
file=${f%.*}
sed '1d' ${f} > ${file}.php;
rm ${f};
done;

Rating: 1

Propose a different solution...