且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

从分隔文件中删除第一行

更新时间:2023-12-04 11:35:10

不要删除它,只要读取和忽略。您必须准备文件,因为文件处理单元无法处理具有不正确的第一行的文件,那么您必须读取并重写它。没有可用的I / O操作,可以从文件系统的文件中删除内容。


I have a delimited file which can contain around millions of records , now I want to delete the first line from the delimited file before processing it further.

The length of the first line is variable , it differs as per the file type.. now I have done a readup on the FileChannel and RandomAccessFile which have been suggested as the best ways to delete the first line.

But I am unable to figure it out , as to how to get the length of the first line and delete it.

Don't delete it, just read-and-ignore.

If you have to prepare the file because the file processing units can't handle a file with an incorrect first line, then you'll have to read and rewrite it. There is no I/O operation available that can delete contents from file in the filesystem.