Dear Experts,
can any one tell me how to display all lines except the last line of a file using awk.
take care
Regards,
SHARY
Dear Experts,
can any one tell me how to display all lines except the last line of a file using awk.
take care
Regards,
SHARY
try this:
awk '{
if (NR != $)
{
print $0
}
}' filename
or
awk 'NR != $ { print $0 }' filename
Try this and do let me know the output.
sed '$d' file
awk '{if(NR>1)print x;x=$0}' infile
With ed you can modify your original file right away:
!!! Be careful, this command will modify your original file !!!
ed infile <<'EOF'
d
w
q
EOF