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 am sure the command "sed"(or may be "awk") can somehow do this in just one line .. so wait till a sed guru bangs the hell out of me .. :-)