#!/bin/ksh
# Program name: numberit
# Put line numbers on all lines of memo
if (( $# < 1 ))
then
print "Usage: $0 filename " >&2
exit 1
fi
integer count=1 # Initialize count
cat $1 | while read line # Input is coming from memo
do
(( count == 1 )) && print "Processing file $1..." > /dev/tty
print $count $line
(( count+=1 ))
done > tmp$$ # Output is going to a temporary file
mv tmp$$ $1
阅读(760) | 评论(0) | 转发(0) |