I have one file in which at the end of file there is one blank line i.e. one enter after last line.
have one script which reads that file but because of that blank line its getting mess up in result so while reading i want to ignore that blank line or before reading can we delete that blank line so further result will be good?
Is anybody's having solution?

# this sed one-liner deletes the last line of the file. Does not check whether it's blank or not: sed '$d' my.txt > mynew.txt
nails
thanks for your reply, but is it possible to delete in same file? I dont want to create mynew.txt file for deletion.
The GNU sed version that runs on most Linux systems has an edit in place flag -i that works on the same file:
sed -i '$d' my.txtBut this won't work on legacy unix systems like AIX, Solaris, HP-UX, etc although GNU versions for these systems are available at gnu.org.
If your system has perl, this one-liner should work:
perl -i -ne 'print unless eof' my.txt
