从分隔文件中删除第一行 [英] Remove first line from delimited file

查看:122
本文介绍了从分隔文件中删除第一行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个可以包含数百万条记录的分隔文件,现在我想从分隔文件中删除第一行,然后再处理它。

第一行的长度是可变的,它根据文件类型而不同。现在我已经对FileChannel和RandomAccessFile进行了读取,删除第一行的最佳方法。



但我无法弄清楚,如何得到第一行的长度并删除它。

解决方案

不要删除它,只要读取和忽略。您必须准备文件,因为文件处理单元无法处理具有不正确的第一行的文件,那么您必须读取并重写它。没有可用的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.

这篇关于从分隔文件中删除第一行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆