File organization:
More UNIX utility commands:
#!/bin/csh
# silly script that counts the number of lines in all files specified on command line, and
# substitutes the string goodbye for the string hello in all of these files that have more than 10 lines
foreach file ( $* )
set nlines = `wc $file | awk '{print $1}'`
if ( $nlines > 10 ) then
sed 's/hello/goodbye/' $file > $file.new
else
echo $file "is a short file!"
endif
end