Afficher un message
Vieux 23/08/2006, 20h20   #4
Steffen Schuler
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: process multiple files

Randy wrote:
> I am new to unix shell.
>
> I need to add a single line to the beginning of multiple ( 100's )
> files. Can I automate this through shell scripting and if so, can
> anyone point me to a newbie resource.
>
> Thanx Randy
>

with GNU tools use:

for FILE in *
do
echo "$LINE" | cat - "$FILE" > "$FILE.NEW"
mv "$FILE.NEW" "$FILE"
done

or use

find -type f -print0 | xargs -r0 sed -i "0i$LINE"

look for

man 1 bash
echo
for
man 1 cat
man 1 mv
info find
man 1 xargs
info sed

Regards,

Steffen Schuler
  Réponse avec citation
 
Page generated in 0,04170 seconds with 9 queries