How to use nodejs to read the contents of txt files and convert them into insert statements of msyql

I have a txt file

there are 10,000 lines

the first line is as follows

27466726----6837605--------398705040011----7605----60664----qq

what I want to extract is

27466726
6837605
398705040011
7605
60664
qq

the second line is as follows

zaistarm----tian--------35046301X----chi----18289----zais
zaistarm
tian
35046301X
chi
18289
zais

the third line is as follows

weizhon.com----wz--------2106260513----wzj----18700----weizhong

the third line looks like

I want to read each line and convert the extracted content in each line into

insert statement of mysql

insert into message_board (name, content, a, b, c, abc) values();

how can I achieve this?

May.19,2022

use split as the delimiter - as the separator. The result of the segmentation is an array, and you can just take it by position

.
Menu