On 06/29/06 11:27, Mangesh V Rakhunde wrote:
How can I delete last line from all files from a Directory
this is a simple and dangerous script - no sanity and error checks done.. you are encouraged to add your own.
for f in * do lines=`cat $f|wc -l` let lines = lines - 1 head -n $lines $f > ${f}.new mv ${f}.new $f done
I tested above code on my system but it throws errors.
s[3]: lines: not found. s[4]:lines: the specified number is not valid for this command has anubody a clue?
Dinesh