将固定宽度的文本文件导入sqlite [英] Import fixed-width text file into sqlite
本文介绍了将固定宽度的文本文件导入sqlite的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有什么好方法可以将固定宽度的文本文件导入到sqlite表格中,最好不用外围软件?
What is a good way to import fixed-width text files into sqlite tables, preferably without using peripheral software?
例如指定每个字段的宽度
E.g. specifying the width of each field
Field 1: 10 characters starting with the second character
Field 2: 5 characters starting with the twelfth character
Field 3: 7 characters starting with the eighteenth character
线
AABCDEFGHIJABCDEAABCDEFGA
将被导入为:
Field 1 Field 2 Field 3
ABCDEFGHIJ ABCDE ABCDEFG
谢谢
推荐答案
sqlite3
工具仅导入 CSV 文件.
The sqlite3
tools imports only CSV files.
有第三方工具可以导入定宽文件,但是这个答案 展示了如何使用字符串函数在 SQLite 中执行此操作.
There are third-party tools that can import fixed-width files, but this answer shows how to do this inside SQLite with string functions.
这篇关于将固定宽度的文本文件导入sqlite的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文