The problem is that we have to calculate the file size and then subtract to get the value of the truncate LENGTH.
Is that soo difficult?
Maybe you're making the same mistake as the other posters and thinking you need to open the file first and seek around in it? You don't:
c:\test>dir junk.dat 18/11/2011 19:23 893 junk.dat c:\test>perl -E"$f=pop; $s=-s($f); truncate $f, $s-40 or die $!" junk. +dat c:\test>dir junk.dat 18/11/2011 19:24 853 junk.dat
In reply to Re^3: Deleting all the data after a specific position in a text file.
by BrowserUk
in thread Deleting all the data after a specific position in a text file.
by pankaj_it09
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |