亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

Go語言實現(xiàn)逐行讀取和寫入文件詳解

 更新時間:2024年01月30日 10:40:37   作者:雪域迷影  
這篇文章主要介紹了如何使用go語言實現(xiàn)從輸入文件中讀取每行數(shù)據(jù),然后將每行字段組合成SQL插入腳本,然后逐行寫入另外一個空白文件中,有需要的可以參考下

前言

前面一篇博客講到nodejs使用readline逐行讀取和寫入文件今天使用go語言實現(xiàn)從輸入文件中讀取每行數(shù)據(jù),然后將每行字段組合成SQL插入腳本,然后逐行寫入另外一個空白文件中。

tb_param表的結構

tb_param表的結構如下:

創(chuàng)建表的SQL腳本如下,我使用的是Sqlite數(shù)據(jù)庫

 DROP TABLE IF EXISTS "main"."tb_param";
CREATE TABLE tb_param(protocol INT NOT NULL,slave INT NOT NULL,number INT NOT NULL,ptype INT NOT NULL,pid INT NOT NULL,name TEXT NOT NULL,format TEXT,PRIMARY KEY(protocol,slave,number,ptype,pid));

前面使用nodejs實現(xiàn)從input.txt文件逐行讀取數(shù)據(jù),然后將每行數(shù)據(jù)拼接成如下的數(shù)據(jù)格式:

INSERT INTO tb_param (protocol, slave, number, ptype, pid, name, format) 
VALUES (2, 6, 0, 1, 1, 'a34004', .0);

輸入文件 input.txt示例如下:

2    24    0    1    1    a04005    .3
2    24    0    1    2    a04006    .3
2    24    0    1    3    a04007    .3
2    16    0    1    1    a99501    .3
2    16    0    1    2    a99502    .3
2    16    0    1    3    a99500    .3
2    16    0    1    4    a99505    .3
2    16    0    1    5    a99504    .3
2    16    0    1    6    a99503    .3
2    22    0    1    23    a24901    .3
2    22    0    1    27    a24904    .3
2    22    0    1    28    a24905    .3
2    22    0    1    29    a24042    .3
2    22    0    1    36    a25002    .3
2    22    0    1    33    a24036    .3
2    22    0    1    32    a24908    .3
2    22    0    1    34    a24909    .3
2    22    0    1    35    a24910    .3
2    22    0    1    37    a24012    .3
2    22    0    1    38    a24043    .3
2    22    0    1    39    a24084    .3
2    22    0    1    40    a24911    .3
2    22    0    1    43    a25003    .3
2    22    0    1    41    a24912    .3
2    22    0    1    42    a24913    .3
2    22    0    1    44    a24070    .3
2    22    0    1    45    a25004    .3
2    22    0    1    47    a25008    .3
2    22    0    1    49    a25038    .3
2    22    0    1    48    a25006    .3
2    22    0    1    46    a24044    .3
2    22    0    1    50    a25034    .3
2    22    0    1    51    a25033    .3
2    22    0    1    52    a25902    .3
2    22    0    1    53    a25014    .3
2    22    0    1    55    a25021    .3
2    22    0    1    56    a25901    .3
2    22    0    1    57    a25019    .3
2    22    0    1    54    a24068    .3
2    22    0    1    58    a25020    .3
2    22    0    1    59    a25903    .3
2    22    0    1    60    a25904    .3
2    22    0    1    61    a24914    .3
2    22    0    1    62    a24915    .3
2    22    0    1    1    a24001    .3
2    22    0    1    2    a24045    .3
2    22    0    1    3    a24002    .3
2    22    0    1    4    a24053    .3
2    22    0    1    5    a24038    .3
2    22    0    1    6    a24037    .3
2    22    0    1    7    a24079    .3
2    22    0    1    8    a24064    .3
2    22    0    1    11    a24063    .3
2    22    0    1    12    a24902    .3
2    22    0    1    13    a24041    .3
2    22    0    1    14    a24039    .3
2    22    0    1    20    a24077    .3
2    22    0    1    18    a24074    .3
2    22    0    1    22    a24076    .3
2    22    0    1    31    a24907    .3
2    22    0    1    24    a24903    .3
2    22    0    1    25    a24011    .3
2    22    0    1    21    a24061    .3
2    22    0    1    30    a24906    .3
2    22    0    1    104    a31005    .3
2    22    0    1    206    a24072    .3
2    22    0    1    221    a05009    .3
2    22    0    1    65    a05014    .3
2    22    0    1    66    a24099    .3
2    22    0    1    67    a24046    .3
2    22    0    1    15    a24078    .3
2    22    0    1    68    a24008    .3
2    22    0    1    69    a24015    .3
2    22    0    1    70    a24916    .3
2    22    0    1    96    a31004    .3
2    22    0    1    97    a31003    .3
2    22    0    1    72    a24047    .3
2    22    0    1    71    a05013    .3
2    22    0    1    98    a31024    .3
2    22    0    1    73    a24100    .3
2    22    0    1    74    a24003    .3
2    22    0    1    101    a28006    .3
2    22    0    1    75    a24016    .3
2    22    0    1    76    a24111    .3
2    22    0    1    77    a24004    .3
2    22    0    1    78    a24018    .3
2    22    0    1    79    a24005    .3
2    22    0    1    80    a24017    .3
2    22    0    1    81    a24049    .3
2    22    0    1    82    a24027    .3
2    22    0    1    83    a24007    .3
2    22    0    1    85    a24112    .3
2    22    0    1    84    a24054    .3
2    22    0    1    86    a24019    .3
2    22    0    1    87    a24050    .3
2    22    0    1    88    a24034    .3
2    22    0    1    89    a25010    .3
2    22    0    1    90    a24009    .3
2    22    0    1    91    a24020    .3
2    22    0    1    92    a25012    .3
2    22    0    1    95    a25011    .3
2    22    0    1    215    a30008    .3
2    22    0    1    219    a99051    .3
2    22    0    1    201    a29026    .3
2    22    0    1    208    a29017    .3
2    22    0    1    106    a31025    .3
2    22    0    1    209    a24110    .3
2    22    0    1    203    a25072    .3
2    22    0    1    222    a29015    .3
2    22    0    1    202    a31030    .3
2    22    0    1    211    a31027    .3
2    22    0    1    207    a24006    .3
2    22    0    1    93    a25013    .3
2    22    0    1    94    a25068    .3
2    22    0    1    204    a25015    .3
2    22    0    1    223    a24113    .3
2    22    0    1    224    a25059    .3
2    22    0    1    9    a24919    .3
2    22    0    1    213    a30003    .3
2    17    0    1    1    a99070    .0
2    17    0    1    2    a99071    .0
2    17    0    1    3    a99072    .0
2    17    0    1    4    a99073    .0
2    17    0    1    5    a99074    .0
2    17    0    1    6    a99075    .0
2    17    0    1    7    a99076    .0
2    17    0    1    8    a99077    .0
2    17    0    1    9    a99078    .0
2    17    0    1    10    a99079    .0
2    17    0    1    11    a99080    .0
2    17    0    1    12    a99081    .0
2    17    0    1    13    a99082    .0
2    17    0    1    14    a99083    .0
2    17    0    1    15    a99084    .0
2    17    0    1    16    a99085    .0
2    17    0    1    17    a99086    .0
2    17    0    1    18    a99087    .0
2    17    0    1    19    a99088    .0
2    17    0    1    20    a99089    .0
2    17    0    1    21    a99090    .0
2    17    0    1    22    a99091    .0
2    17    0    1    23    a99092    .0
2    17    0    1    24    a99093    .0
2    17    0    1    25    a99094    .0
2    17    0    1    26    a99095    .0
2    17    0    1    27    a99096    .0
2    17    0    1    28    a99097    .0
2    17    0    1    29    a99098    .0
2    17    0    1    30    a99099    .0
2    17    0    1    31    a99100    .0
2    17    0    1    32    a99101    .0
2    17    0    1    35    a99102    .1
2    17    0    1    36    a99103    .1
2    17    0    1    37    a99104    .1

Go語言實現(xiàn)代碼

readFile.go 代碼如下:

package main

import (
	"fmt"
	"os"
	"bufio"
	"strconv"
	"strings"
)

func main() {
	// open the file filepath
	fRead, err := os.Open("./input.txt")
	if err != nil {
		fmt.Println("failed open the file input.txt")
		panic(err)
	}
	defer fRead.Close()

	// 創(chuàng)建輸出文件 output.txt 用于存放輸出結果
	strDestFileName := "./output.txt"
	fWrite, err2 := os.Create(strDestFileName)
	if err2 != nil {
		fmt.Println(err.Error())
		panic(err2)
	}
	defer fWrite.Close()

	// create a scanner
	fs := bufio.NewScanner(fRead)

	// scan file
	// https://golang.org/pkg/bufio/#Scanner.Scan
	for fs.Scan() {
		strLine := fs.Text()
		// do anything with strLine
		fmt.Println(strLine)
		strLineSplit := strings.Split(strLine, "\t")
		strProtocol := strLineSplit[0]
		strSlave := strLineSplit[1]
		strNumber := strLineSplit[2]
		strPtype := strLineSplit[3]
		strPid := strLineSplit[4]
		strName := strLineSplit[5]
		strFormat := strLineSplit[6]

		iProtocol, err3 := strconv.Atoi(strProtocol)
		if err3 != nil {
			fmt.Println("轉換strProtocol從string到int失敗")
			panic(err3)
		}

		iSlave, err4 := strconv.Atoi(strSlave)
		if err4 != nil {
			fmt.Println("轉換strSlave從string到int失敗")
			panic(err4)
		}

		iNumber, err5 := strconv.Atoi(strNumber)
		if err5 != nil {
			fmt.Println("轉換strNumber從string到int失敗")
			panic(err5)
		}

		iPtype, err6 := strconv.Atoi(strPtype)
		if err6 != nil {
			fmt.Println("轉換strPtype從string到int失敗")
			panic(err6)
		}

		iPid, err7 := strconv.Atoi(strPid)
		if err7 != nil {
			fmt.Println("轉換strPid從string到int失敗")
			panic(err7)
		}

		// 根據(jù)讀取到的每行數(shù)據(jù),按照指定格式拼接成SQL插入腳本,按\n換行符進行分割
		strResult := fmt.Sprintf("INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)\n " +
			" VALUES(%d, %d, %d, %d, %d, '%v', '%v')\n", iProtocol, iSlave, iNumber, iPtype, iPid, strName, strFormat)
		// 將格式化處理的每行數(shù)據(jù)寫入到文件output.txt中
		fWrite.WriteString(strResult)
		// fmt.Fprintf(fWrite, strResult)
	}
}

運行上述代碼并獲得輸出

go run readFile.go

得到輸出文件output.txt如下所示:

INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 24, 0, 1, 1, 'a04005', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 24, 0, 1, 2, 'a04006', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 24, 0, 1, 3, 'a04007', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 16, 0, 1, 1, 'a99501', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 16, 0, 1, 2, 'a99502', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 16, 0, 1, 3, 'a99500', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 16, 0, 1, 4, 'a99505', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 16, 0, 1, 5, 'a99504', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 16, 0, 1, 6, 'a99503', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 23, 'a24901', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 27, 'a24904', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 28, 'a24905', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 29, 'a24042', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 36, 'a25002', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 33, 'a24036', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 32, 'a24908', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 34, 'a24909', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 35, 'a24910', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 37, 'a24012', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 38, 'a24043', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 39, 'a24084', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 40, 'a24911', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 43, 'a25003', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 41, 'a24912', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 42, 'a24913', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 44, 'a24070', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 45, 'a25004', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 47, 'a25008', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 49, 'a25038', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 48, 'a25006', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 46, 'a24044', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 50, 'a25034', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 51, 'a25033', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 52, 'a25902', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 53, 'a25014', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 55, 'a25021', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 56, 'a25901', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 57, 'a25019', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 54, 'a24068', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 58, 'a25020', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 59, 'a25903', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 60, 'a25904', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 61, 'a24914', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 62, 'a24915', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 1, 'a24001', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 2, 'a24045', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 3, 'a24002', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 4, 'a24053', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 5, 'a24038', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 6, 'a24037', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 7, 'a24079', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 8, 'a24064', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 11, 'a24063', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 12, 'a24902', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 13, 'a24041', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 14, 'a24039', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 20, 'a24077', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 18, 'a24074', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 22, 'a24076', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 31, 'a24907', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 24, 'a24903', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 25, 'a24011', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 21, 'a24061', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 30, 'a24906', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 104, 'a31005', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 206, 'a24072', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 221, 'a05009', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 65, 'a05014', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 66, 'a24099', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 67, 'a24046', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 15, 'a24078', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 68, 'a24008', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 69, 'a24015', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 70, 'a24916', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 96, 'a31004', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 97, 'a31003', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 72, 'a24047', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 71, 'a05013', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 98, 'a31024', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 73, 'a24100', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 74, 'a24003', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 101, 'a28006', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 75, 'a24016', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 76, 'a24111', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 77, 'a24004', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 78, 'a24018', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 79, 'a24005', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 80, 'a24017', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 81, 'a24049', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 82, 'a24027', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 83, 'a24007', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 85, 'a24112', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 84, 'a24054', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 86, 'a24019', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 87, 'a24050', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 88, 'a24034', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 89, 'a25010', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 90, 'a24009', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 91, 'a24020', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 92, 'a25012', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 95, 'a25011', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 215, 'a30008', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 219, 'a99051', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 201, 'a29026', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 208, 'a29017', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 106, 'a31025', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 209, 'a24110', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 203, 'a25072', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 222, 'a29015', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 202, 'a31030', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 211, 'a31027', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 207, 'a24006', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 93, 'a25013', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 94, 'a25068', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 204, 'a25015', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 223, 'a24113', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 224, 'a25059', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 9, 'a24919', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 22, 0, 1, 213, 'a30003', '.3')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 17, 0, 1, 1, 'a99070', '.0')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 17, 0, 1, 2, 'a99071', '.0')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 17, 0, 1, 3, 'a99072', '.0')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 17, 0, 1, 4, 'a99073', '.0')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 17, 0, 1, 5, 'a99074', '.0')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 17, 0, 1, 6, 'a99075', '.0')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 17, 0, 1, 7, 'a99076', '.0')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 17, 0, 1, 8, 'a99077', '.0')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 17, 0, 1, 9, 'a99078', '.0')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 17, 0, 1, 10, 'a99079', '.0')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 17, 0, 1, 11, 'a99080', '.0')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 17, 0, 1, 12, 'a99081', '.0')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 17, 0, 1, 13, 'a99082', '.0')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 17, 0, 1, 14, 'a99083', '.0')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 17, 0, 1, 15, 'a99084', '.0')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 17, 0, 1, 16, 'a99085', '.0')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 17, 0, 1, 17, 'a99086', '.0')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 17, 0, 1, 18, 'a99087', '.0')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 17, 0, 1, 19, 'a99088', '.0')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 17, 0, 1, 20, 'a99089', '.0')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 17, 0, 1, 21, 'a99090', '.0')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 17, 0, 1, 22, 'a99091', '.0')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 17, 0, 1, 23, 'a99092', '.0')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 17, 0, 1, 24, 'a99093', '.0')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 17, 0, 1, 25, 'a99094', '.0')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 17, 0, 1, 26, 'a99095', '.0')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 17, 0, 1, 27, 'a99096', '.0')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 17, 0, 1, 28, 'a99097', '.0')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 17, 0, 1, 29, 'a99098', '.0')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 17, 0, 1, 30, 'a99099', '.0')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 17, 0, 1, 31, 'a99100', '.0')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 17, 0, 1, 32, 'a99101', '.0')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 17, 0, 1, 35, 'a99102', '.1')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 17, 0, 1, 36, 'a99103', '.1')
INSERT INTO tb_param(protocol, slave, number, ptype, pid, name, format)
  VALUES(2, 17, 0, 1, 37, 'a99104', '.1')

以上就是Go語言實現(xiàn)逐行讀取和寫入文件詳解的詳細內(nèi)容,更多關于Go逐行讀取寫入文件的資料請關注腳本之家其它相關文章!

相關文章

  • 利用ChatGPT編寫一個Golang圖像壓縮函數(shù)

    利用ChatGPT編寫一個Golang圖像壓縮函數(shù)

    這篇文章主要為大家詳細介紹了如何利用ChatGPT幫我們寫了一個Golang圖像壓縮函數(shù),文中的示例代碼簡潔易懂,感興趣的小伙伴可以嘗試一下
    2023-04-04
  • Go并發(fā)同步Mutex典型易錯使用場景

    Go并發(fā)同步Mutex典型易錯使用場景

    這篇文章主要為大家介紹了Go并發(fā)同步Mutex典型易錯使用場景示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步,早日升職加薪
    2022-08-08
  • Go操作mongodb數(shù)據(jù)庫方法示例

    Go操作mongodb數(shù)據(jù)庫方法示例

    這篇文章主要為大家介紹了Go操作mongodb數(shù)據(jù)庫方法示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步,早日升職加薪
    2023-09-09
  • golang 刪除切片的某個元素及剔除切片內(nèi)的零值方式

    golang 刪除切片的某個元素及剔除切片內(nèi)的零值方式

    這篇文章主要介紹了golang 刪除切片的某個元素及剔除切片內(nèi)的零值方式,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2021-04-04
  • go?time.After優(yōu)化后性能提升34%內(nèi)存減少67%

    go?time.After優(yōu)化后性能提升34%內(nèi)存減少67%

    這篇文章主要介紹了go語言time.After優(yōu)化后性能提升34%內(nèi)存減少67%實例分析,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步,早日升職加薪
    2023-02-02
  • go語言處理JSON和XML數(shù)據(jù)示例解析

    go語言處理JSON和XML數(shù)據(jù)示例解析

    這篇文章主要介紹了go語言處理JSON和XML數(shù)據(jù)的示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步,早日升職加薪
    2023-08-08
  • go語言中int和byte轉換方式

    go語言中int和byte轉換方式

    這篇文章主要介紹了go語言中int和byte轉換方式,需要的朋友可以參考下
    2018-11-11
  • go實現(xiàn)反轉鏈表

    go實現(xiàn)反轉鏈表

    這篇文章主要介紹了go實現(xiàn)反轉鏈表的操作,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2021-04-04
  • Go語言json編碼駝峰轉下劃線、下劃線轉駝峰的實現(xiàn)

    Go語言json編碼駝峰轉下劃線、下劃線轉駝峰的實現(xiàn)

    這篇文章主要介紹了Go語言json編碼駝峰轉下劃線、下劃線轉駝峰的實現(xiàn),文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧
    2020-06-06
  • golang中的struct操作

    golang中的struct操作

    結構體是一種聚合的數(shù)據(jù)類型,是由零個或多個任意類型的值聚合成的實體,每個值稱為結構體的成員。下面介紹下golang中的struct,感興趣的朋友一起看看吧
    2021-11-11

最新評論