File processing method, device, equipment and storage medium
By storing the files to be processed in a string array and using preset rule files to extract data, a configuration file in a specific format is formed, which solves the problem of inefficient export of edge node data, realizes automatic extraction and dumping, and is suitable for multiple communications Server scenario.
Patent Information
- Application Number
- CN202011633540.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-31
- Publication Date
- 2024-09-13
- Estimated Expiration
- 2040-12-31
AI Technical Summary
The existing technology cannot automatically extract and dump routing data or multimedia messages generated by multiple communication servers at edge nodes, resulting in manual operations that are time-consuming, labor-intensive, and inefficient.
By obtaining the file to be processed, storing it in a string array, and using the preset rule file to extract data, a configuration file in a specific format is formed for the second server to recognize and use.
It realizes the automatic extraction and dumping of file data to be processed, improves efficiency and reduces the need for manual operations. It is suitable for messaging business and intelligent network data processing scenarios.
Smart Images

Figure CN114697311B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of wireless communication technology, and in particular to a file processing method, device, equipment and storage medium. Background Art
[0002] With the rapid development of mobile communication technology and the low latency requirements for services, the number of edge nodes is increasing. In actual applications, multiple communication servers can be deployed at the edge nodes, and the routing data or multimedia messages generated by multiple communication servers can be stored in a file. The routing data may include server addresses, port numbers, etc., and the multimedia messages may include medical messages, current affairs messages, etc. When the routing data or multimedia messages in the file are exported to a communication server for use, it is necessary to manually export the data in the file and organize it into a file that the server can recognize and use directly. It is impossible to automatically extract and dump the data in the file, which is time-consuming and labor-intensive, and has low efficiency. Summary of the invention
[0003] In view of this, embodiments of the present invention are intended to provide a file processing method, apparatus, device and storage medium.
[0004] The technical solution of the embodiment of the present invention is achieved as follows:
[0005] An embodiment of the present invention is intended to provide a file processing method, which is applied to a first server, and the method includes:
[0006] Acquire a file to be processed; the file to be processed is a file formed by multimedia messages or routing data generated by multiple communication servers of the edge node;
[0007] Store the data in the to-be-processed file into a string array;
[0008] Read the preset rule file;
[0009] The preset rule file is used to extract the data in the string array to form a configuration file in a specific format; the configuration file is used for identification and use by the second server.
[0010] In addition, according to at least one embodiment of the present invention, the extracting data in the string array using a preset rule file includes:
[0011] Determining at least two properties of the string array;
[0012] For each of the at least two attributes, searching the preset rule file for an instruction corresponding to the corresponding attribute to obtain at least two instructions; the preset rule file stores a correspondence between the attribute and the instruction;
[0013] Based on the at least two instructions, data in the string array is extracted.
[0014] In addition, according to at least one embodiment of the present invention, searching for instructions corresponding to the corresponding attributes from the preset rule file includes:
[0015] Determining whether the corresponding attribute meets a first preset condition;
[0016] When it is determined that the corresponding attribute satisfies the first preset condition, taking the first instruction in the preset rule file as the instruction corresponding to the corresponding attribute;
[0017] The first instruction is an instruction for reading data from the string array according to a preset position.
[0018] In addition, according to at least one embodiment of the present invention, the method further includes one of the following:
[0019] Based on the first instruction, read data from a fixed position of the string array;
[0020] Based on the first instruction, read data from the string array in a row-by-row increment manner;
[0021] Based on the first instruction, data is read from the string array in a column-increasing manner.
[0022] In addition, according to at least one embodiment of the present invention, searching for instructions corresponding to the corresponding attributes from the preset rule file includes:
[0023] Determining whether the corresponding attribute meets a second preset condition;
[0024] When it is determined that the corresponding attribute satisfies the second preset condition, taking the second instruction in the preset rule file as the instruction corresponding to the corresponding attribute;
[0025] The second instruction is an instruction capable of modifying the numerical value in the string array.
[0026] In addition, according to at least one embodiment of the present invention, the method further includes one of the following:
[0027] Based on the second instruction, extract the first data corresponding to the corresponding attribute in the string array; replace the first data with the second data; the second data is used to form a configuration file in a specific format;
[0028] Based on the second instruction, extract the first data corresponding to the corresponding attribute in the string array; combine the first data with preset data to obtain combined data; and use the combined data to form a configuration file in a specific format.
[0029] In addition, according to at least one embodiment of the present invention, searching for an instruction corresponding to the attribute from a preset rule file includes:
[0030] Determining whether the corresponding attribute meets a third preset condition;
[0031] When it is determined that the corresponding attribute satisfies the third preset condition, taking the third instruction in the preset rule file as the instruction corresponding to the corresponding attribute;
[0032] The third instruction is an instruction for processing data of at least two cells in the string array.
[0033] In addition, according to at least one embodiment of the present invention, the method further includes one of the following:
[0034] Based on the third instruction, the first data corresponding to the corresponding attribute and the third data corresponding to other attributes in the string array are merged, and the merged data is extracted; the merged data is used to form a configuration file in a specific format;
[0035] Based on the second instruction, the first data corresponding to the corresponding attribute and the fourth data corresponding to other attributes in the string array are operated, and the operated data are extracted; the operated data are used to form a configuration file in a specific format.
[0036] At least one embodiment of the present invention provides a file processing device, comprising:
[0037] An acquisition unit, used for acquiring a file to be processed; the file to be processed is a file formed by multimedia messages or routing data generated by multiple communication servers of the edge node;
[0038] A first processing unit, used for storing the data in the to-be-processed file into a string array;
[0039] The second processing unit is used to read a preset rule file; use the preset rule file to extract the data in the string array to form a configuration file in a specific format; the configuration file is used for the second server to identify and use.
[0040] In addition, according to at least one embodiment of the present invention, the second processing unit is specifically configured to:
[0041] Determining at least two properties of the string array;
[0042] For each of the at least two attributes, searching the preset rule file for an instruction corresponding to the corresponding attribute to obtain at least two instructions; the preset rule file stores a correspondence between the attribute and the instruction;
[0043] Based on the at least two instructions, data in the string array is extracted.
[0044] In addition, according to at least one embodiment of the present invention, the second processing unit is specifically used to: determine whether the corresponding attribute meets a first preset condition;
[0045] When it is determined that the corresponding attribute satisfies the first preset condition, taking the first instruction in the preset rule file as the instruction corresponding to the corresponding attribute;
[0046] The first instruction is an instruction for reading data from the string array according to a preset position.
[0047] In addition, according to at least one embodiment of the present invention, the second processing unit is further configured to perform one of the following operations:
[0048] Based on the first instruction, read data from a fixed position of the string array;
[0049] Based on the first instruction, read data from the string array in a row-by-row increment manner;
[0050] Based on the first instruction, data is read from the string array in a column-increasing manner.
[0051] In addition, according to at least one embodiment of the present invention, the second processing unit is specifically configured to:
[0052] Determining whether the corresponding attribute meets a second preset condition;
[0053] When it is determined that the corresponding attribute satisfies the second preset condition, taking the second instruction in the preset rule file as the instruction corresponding to the corresponding attribute;
[0054] The second instruction is an instruction capable of modifying the numerical value in the string array.
[0055] In addition, according to at least one embodiment of the present invention, the second processing unit is further configured to perform one of the following operations:
[0056] Based on the second instruction, extract the first data corresponding to the corresponding attribute in the string array; replace the first data with the second data; the second data is used to form a configuration file in a specific format;
[0057] Based on the second instruction, extract the first data corresponding to the corresponding attribute in the string array; combine the first data with preset data to obtain combined data; and use the combined data to form a configuration file in a specific format.
[0058] In addition, according to at least one embodiment of the present invention, the second processing unit is specifically configured to:
[0059] Determining whether the corresponding attribute meets a third preset condition;
[0060] When it is determined that the corresponding attribute satisfies the third preset condition, taking the third instruction in the preset rule file as the instruction corresponding to the corresponding attribute;
[0061] The third instruction is an instruction for processing data of at least two cells in the string array.
[0062] In addition, according to at least one embodiment of the present invention, the second processing unit is further configured to perform one of the following operations:
[0063] Based on the third instruction, the first data corresponding to the corresponding attribute and the third data corresponding to other attributes in the string array are merged, and the merged data is extracted; the merged data is used to form a configuration file in a specific format;
[0064] Based on the second instruction, the first data corresponding to the corresponding attribute and the fourth data corresponding to other attributes in the string array are operated, and the operated data are extracted; the operated data are used to form a configuration file in a specific format.
[0065] At least one embodiment of the present invention provides a communication device, including:
[0066] A communication interface, used to obtain a file to be processed; the file to be processed is a file formed by multimedia messages or routing data generated by multiple communication servers of the edge node;
[0067] The processor is used to store the data in the file to be processed into a string array; and read a preset rule file; using the preset rule file, extract the data in the string array to form a configuration file in a specific format; the configuration file is used for the second server to identify and use.
[0068] At least one embodiment of the present invention provides a communication device, comprising a processor and a memory for storing a computer program that can be run on the processor.
[0069] Wherein, the processor is used to execute the steps of any of the above methods when running the computer program.
[0070] At least one embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the steps of any of the above methods when executed by a processor.
[0071] The file processing method, device, equipment and storage medium provided by the embodiment of the present invention obtain a file to be processed; the file to be processed is a file formed by multimedia messages or routing data generated by multiple communication servers of an edge node; the data in the file to be processed is stored in a string array; a preset rule file is read; the data in the string array is extracted using the preset rule file to form a configuration file in a specific format; the configuration file is used for identification and use by a second server. By adopting the technical solution of the embodiment of the present invention, in a message business scenario or an intelligent network data processing scenario, the data in the file to be processed, such as multimedia messages or routing data, can be structuredly stored through a string array, and in combination with a preset rule file, the data in the file to be processed can be batch extracted and transferred to the second server in a configuration file in a specific format, thereby realizing automatic data extraction and dumping, saving time and effort, and being highly efficient. BRIEF DESCRIPTION OF THE DRAWINGS
[0072] Figure 1 It is a schematic diagram of the implementation flow of the file processing method according to an embodiment of the present invention;
[0073] Figure 2 The following is a schematic diagram of the implementation process of extracting and dumping the files to be processed according to the embodiment of the present invention. Figure 1 ;
[0074] Figure 3 The following is a schematic diagram of the implementation process of extracting and dumping the files to be processed according to the embodiment of the present invention. Figure 2 ;
[0075] Figure 4 The following is a schematic diagram of the implementation process of extracting and dumping the files to be processed according to the embodiment of the present invention. Figure 3 ;
[0076] Figure 5 Schematic diagram of a system framework for the application of the file processing method according to an embodiment of the present invention;
[0077] Figure 6 A schematic diagram of reading a file to be processed into a four-dimensional string array according to an embodiment of the present invention;
[0078] Figure 7 is a schematic diagram of the code structure executed by the parsing module according to an embodiment of the present invention;
[0079] Figure 8It is a schematic diagram of the implementation process of automatically extracting and dumping data in a file to be processed according to an embodiment of the present invention;
[0080] Fig. 9 It is a schematic diagram of the structure of a file processing device according to an embodiment of the present invention;
[0081] Fig.10 It is a schematic diagram of the structure of the communication device according to the embodiment of the present invention. DETAILED DESCRIPTION
[0082] Before introducing the technical solution of the embodiment of the present invention, the related technology is first described.
[0083] In the related art, with the development of 5G technology, new services have higher and higher requirements for the computing power and latency of the communication network, and the trend of industry-network integration has become more and more obvious, resulting in an explosive growth of edge nodes. The 5G edge computing service involves a large amount of routing configuration information in the existing network communication server. Among them, since the 5G media processing communication server is deployed on the edge node, its configuration file involves a large amount of routing information, including Internet Protocol (IP) address, server address, port number, etc. Its verification work is generally completed manually and recorded in the form of Excel data sheets. The server configuration work is also manually filled in the format of a text configuration file through an Excel data sheet. With the increase in the number of edge nodes and servers in the existing network, the amount of information and data increases, and the demand for automated and batch processing of data is also increasing. A specific typical application scenario is to export the routing data in the communication server according to a certain rule and organize it into another specific format. This format can be recognized and directly used by the augmented reality (AR) communication server. Due to the uncertainty of this rule, the range and characteristics of the data to be exported are uncertain. In addition, the output format also varies according to various needs, and the output information cannot be directly used by the communication server. The communication server data needs to organize the data in Excel into a proprietary INI configuration information format. The information extraction and dumping of the communication server data files are currently mainly solved through the following methods: through a special automated extraction tool, all data in the communication server data file is exported to some other format, and then the useful data is manually screened and organized into the required format; first use the built-in filtering function in Excel to select useful data, and then manually organize it into the required format; the data in Excel is extracted completely through manual operation according to the required rules, and then manually organized into the required format.
[0084] In summary, because different communication node configuration tables are different, the filled-in Excel templates also have certain differences, so the rules for extracting and dumping communication server data are uncertain. For different scenarios, the specific rules are different. Therefore, the above existing solutions are inseparable from the process of manual screening and sorting. The existing problems mainly include: First, the mode of manual screening and sorting data is inefficient. The amount of configuration data of only one server node in the actual live network can reach tens of thousands (including security verification parameters and routing information). The configuration file required in the end also includes the permutation and combination exchange information between routing nodes. Manually configuring a server node requires about a month of work, which is costly and slow. Second, for large quantities of data, manual screening and sorting of data is prone to errors, affecting the normal operation of the actual live network system. Third, all data can only be exported or exported using fixed rules, which is inflexible; using Excel's built-in filtering function to filter data, although the built-in filtering function is powerful, for large quantities of data tables, each table still needs to be filtered to be successfully exported, and the dump format cannot be determined, and the overall efficiency is not high.
[0085] Based on this, in each embodiment of the present invention, a file to be processed is obtained; the data in the file to be processed is stored in a string array; a preset rule file is read; the data in the string array is extracted using the preset rule file to form a configuration file in a specific format; the configuration file is used for identification and use by the second server.
[0086] It should be noted that, in the embodiment of the present invention, the data in the to-be-processed file is extracted and dumped by combining the string array and the preset rule file, which has the following advantages:
[0087] (1) The application scenarios are relatively broad, and can be applied to message business scenarios and intelligent network data processing scenarios.
[0088] (2) Based on the string array, the data in the file to be processed is structured and stored, and combined with the preset rule file, the automatic batch extraction and dumping of the server data file based on the custom rule file is realized, and a configuration file that can be directly identified and read by the second server is generated, which effectively improves the efficiency of the first server in data extraction and dumping. Moreover, the processed data can be directly used by the second server. The second server can specifically be a 5G media processing edge node server.
[0089] (3) The preset rule file is a label-type rule file, which can implement a variety of instructions for data extraction and dumping, that is, the rule file can provide a large number of data extraction / screening instructions, and can be written in plain text and recognized by the software, which has high flexibility.
[0090] (4) In response to different extraction / dumping requirements of users, a simple rule file can be written, which can be recognized by the program and then realize automated communication server data extraction and dumping for this extraction scenario, generating a configuration file that can be directly read and used by the communication server. That is, the preset rule file is a one-time labor, and subsequent repetitive work does not require manual labor at all, thereby greatly improving efficiency, and the automated processing method can effectively avoid errors.
[0091] The present invention will be described in further detail below in conjunction with the accompanying drawings and embodiments.
[0092] The embodiment of the present invention provides a file processing method, which is applied to a first server, such as Figure 1 As shown, the method includes:
[0093] Step 101: Obtain a file to be processed; the file to be processed is a file formed by multimedia messages or routing data generated by multiple communication servers of an edge node;
[0094] Step 102: storing the data in the to-be-processed file into a string array;
[0095] Step 103: Read a preset rule file; use the preset rule file to extract the data in the string array to form a configuration file in a specific format; the configuration file is used for the second server to identify and use.
[0096] Here, in step 101, the file to be processed may refer to a file loaded by a user in the first server, or a file formed by routing data; specifically, it may refer to a file storing multimedia messages or routing data generated by multiple communication servers of edge nodes in the form of Excel or the like; wherein, the first server may be a media processing communication server, and the second server may be an AR server; the routing data may include an IP address, a server address, a port number, etc., and the multimedia message may be a news message or a medical message.
[0097] Here, in step 102, the string array may refer to an array capable of storing strings, such as a two-dimensional array, a four-dimensional array, etc. In actual application, the data stored in the string array may be composed of attributes and attribute values, and the attributes may include: server IP address, port number, etc., and the attribute values may include: 172.155.20.15, 2007, etc. In this way, the data in the to-be-processed file may be stored as fixed-format data according to the format defined by the string array, and subsequently, the data in the string array may be conveniently and quickly extracted using a preset rule file.
[0098] Here, in step 103, in actual application, after the data in the file to be processed is stored in the string array, if the data is read and dumped to the second server according to the data format stored in the string array, since the read data does not meet the format and other requirements of the server, the second server will not be able to recognize the data, and the data cannot be directly used by the second server. Therefore, in an embodiment of the present invention, the data stored in the string array can be extracted according to a preset rule file, so as to ensure that the data extracted from the string array meets the requirements of the second server, and further ensure that the second server can recognize the extracted data and use it directly.
[0099] The following is a detailed description of the process of extracting and dumping the data in the file to be processed.
[0100] In actual application, the user can load the to-be-processed file on the communication server. The to-be-processed file can store a large amount of routing data through at least one Excel table, so that each cell in the Excel can be read to store the data in each cell in the corresponding cell of the string array.
[0101] Based on this, in one embodiment, storing the data in the to-be-processed file into a string array includes:
[0102] Reading data from the to-be-processed file in a cell-by-cell manner;
[0103] The read data is stored in the corresponding cell of the string array.
[0104] Here, the string array can store an array of strings, specifically a two-dimensional array, a four-dimensional array, etc.
[0105] For example, taking the string array as a four-dimensional array, when multiple files to be processed are loaded in the communication server, for each file to be processed, the file class can be read, each cell of each data table of each file to be processed can be traversed and filled into the corresponding cell of the four-dimensional array.
[0106] Here, the four-dimensional array may include:
[0107] The first dimension may refer to a workbook index (WorkbookIndex), where each number corresponds to a communication database file and the numbering starts from 0.
[0108] The second dimension may refer to the data sheet index (SheetIndex), where each number corresponds to a sheet in the XLS file, starting from 0, and the XLS file may have one or more data sheets.
[0109] The third and fourth dimensions can refer to the cell row and column index (Column & Row), where each number corresponds to the row number / column number of a cell in a table, starting from 0.
[0110] Here, the boundaries of the four-dimensional array can be pre-configured. The default setting is to process a maximum of 10 files to be processed at a time. Assuming that XLS files are used, each XLS file allows a maximum of 20 sub-data tables, and each sub-data table must not exceed 6000 rows / 100 columns. The configuration can be modified according to needs and system memory conditions.
[0111] Here, the four-dimensional array may be named Exceldata[a,b,c,d], and the four-dimensional array may store all the files to be processed in the communication servers loaded by the user, and directly store them in the memory in the structured form of array variables, so as to facilitate subsequent high-speed analysis and processing for dumping to another server. Among them, Exceldata[0][0][0][0] represents the value of the data in the cell of the first row and the first column of the first Excel table of the first file to be processed, and so on.
[0112] In actual application, considering that the data format stored in the string array cannot be directly used by the second server, multiple instructions can be stored in a preset rule file, and instructions corresponding to the attributes of the string array can be used to extract data so that the extracted data meets the requirements of the second server.
[0113] Based on this, in one embodiment, the extracting data in the string array using a preset rule file includes:
[0114] Determining at least two properties of the string array;
[0115] For each of the at least two attributes, searching the preset rule file for an instruction corresponding to the corresponding attribute to obtain at least two instructions; the preset rule file stores a correspondence between the attribute and the instruction;
[0116] Based on the at least two instructions, data in the string array is extracted.
[0117] Table 1 is the correspondence between the attributes of the string array and the instructions in the preset rule file. As shown in Table 1, assuming that the attributes of the string array include attribute 1 and attribute 2, instructions 1 and instruction 2 are found from the preset rule file, and instructions 1 and instruction 2 are used to extract the data in the string array to form a configuration file in a specific format. Assuming that the attributes of the string array include attribute 1, attribute 2, and attribute 3, instructions 1, instruction 2, and instruction 3 are found from the preset rule file, and instructions 1, instruction 2, and instruction 3 are used to extract the data in the string array to form a configuration file in a specific format.
[0118] String array properties Directives in the default rules file Property 1 Instruction 1 Property 2 Instruction 2 Property 3 Directive 3
[0119] Table 1
[0120] In actual application, considering that the value of the attribute stored in the string array can be a fixed value or a value that changes in a certain regularity, the preset rule file can store instructions for reading data according to the value of the attribute.
[0121] Based on this, in one embodiment, searching for instructions corresponding to the corresponding attributes from the preset rule file includes:
[0122] Determining whether the corresponding attribute meets a first preset condition;
[0123] When it is determined that the corresponding attribute satisfies the first preset condition, taking the first instruction in the preset rule file as the instruction corresponding to the corresponding attribute;
[0124] The first instruction is an instruction for reading data from the string array according to a preset position.
[0125] Here, the corresponding attribute satisfying the first preset condition may mean that the value corresponding to the corresponding attribute is a fixed value, or the value of the corresponding attribute is a value that changes in a certain regularity.
[0126] In actual application, if the value corresponding to the attribute of the string array is a fixed value, the corresponding data can be extracted using an instruction for reading data from a fixed position of the string array; if the value corresponding to the attribute of the string array is variable, the corresponding data can be extracted using an instruction for reading data from the string array in ascending rows or columns.
[0127] Based on this, in one embodiment, the method further includes one of the following:
[0128] Based on the first instruction, read data from a fixed position of the string array;
[0129] Based on the first instruction, read data from the string array in a row-by-row increment manner;
[0130] Based on the first instruction, data is read from the string array in a column-increasing manner.
[0131] Table 2 is the correspondence between the attributes of the string array and the first instruction. As shown in Table 2, assuming that the attributes of the string array are fixed values, instruction 1 is found from the preset rule file, and instruction 1 is used to extract the data in the string array; assuming that the attributes of the string array are values that change by column, instruction 2 is found from the preset rule file, and instruction 1 is used to extract the data in the string array; assuming that the attributes of the string array are values that change by row, instruction 3 is found from the preset rule file, and instruction 3 is used to extract the data in the string array.
[0132] String array properties First Directive The attribute value is a fixed value Instruction 1 (xls) The attribute value is a value that changes by column Instruction 2 (autocolumn) The attribute value is a value that changes by row Instruction 3 (autorow)
[0133] Table 2
[0134] Taking instruction 1 as an example, the process of reading data from a fixed position of the string array based on the first instruction is described as follows:
[0135] Here, the attributes or attribute names of the string array can be read as follows:
[0136] Property (or property name) = xls|column|row|sheetIndex|workbookIndex
[0137] Assume that column=1, row=1, sheetIndex=1, workbookIndex=1, and the read property is: device port=xls|2|1|1|1. Assume that the property value corresponding to the device port is a fixed value, then find instruction 1 from the preset rule file, which can be expressed as xls, where instruction 1 is an instruction to read data from a fixed position in a string array.
[0138] Here, the data in the string array may be read in the following manner based on the instruction 1:
[0139] xls|column number|row number|sheet number|XLS file number (starts from 1 by default)
[0140] Assuming that the column number = 2, the row number = 1, the worksheet number = 1, and the XLS file number = 1, it means that the data of the corresponding device port attributes are extracted from the 2 columns and 1 row of the 1st worksheet of the first file to be processed XLS.
[0141] Taking instruction 2 as an example, the process of reading data from the string array in a column-increasing manner based on the first instruction is described as follows:
[0142] Here, the attributes or attribute names of the string array can be read as follows:
[0143] Attribute Name =
[0144] autocolumn|start_column|start_row|step|sheetIndex|workbookIndex|stepWait
[0145] Assuming start_column = 2, start_row = 2, step = 3, sheetIndex = 2, workbookIndex = 0, stepWait = 0, the read attribute is: device port = autocolumn|2|2|3|2|0|0, assuming that the device port number changes in increments according to the column, then find instruction 2 from the preset rule file, which can be represented by autocolumn. Among them, instruction 2 is an instruction to read data from the string array in increments of columns. Specifically, it can refer to taking values from a column in the string array, and automatically skipping n rows at a step length each time to take the next value until all items are output. For example, assuming that the second column of the string array is a value that increases in step length 1, the position and step length corresponding to the first item can be specified to achieve automatic data reading; assuming that the second column of the string array is the same value, the position and step length corresponding to the first item can also be specified to achieve automatic data reading.
[0146] Here, the data in the string array may be read in the following manner based on the instruction 2:
[0147] autocolumn|starting value column number|starting value row number|step length|worksheet number|XLS file number|step length wait
[0148] Among them, the parameter value of step wait (stepWait) is 0 or 1. If the step wait value is 0, it means that this parameter needs to be read for each step. If the compensation wait value is 1, it means that this parameter changes only once every step.
[0149] Assuming that the starting value column number = 2, the starting value row number = 2, the step length = 3, the worksheet number = 2, the XLS file number = 1, and the step length wait = 0, it means that the initial data is obtained from the 2nd column and 2nd row of the second worksheet in (the first Excel file) and placed in the initial field, and the data is obtained from the 2nd column and 2+3=5th row of the second worksheet and placed in the next field. Assuming the step length wait value (StepWait) is 0, there is no need to change the value after a step length, and the data will always be extracted according to the step length.
[0150] Taking instruction 3 as an example, the process of reading data from the string array in a row-increasing manner based on the first instruction is described as follows:
[0151] Here, the attributes or attribute names of the string array can be read as follows:
[0152] Attribute name=autorow|start_column|start_row|step|sheetIndex|workbookIndex
[0153] Assuming start_column=2, start_row=2, step=3, sheetIndex=2, workbookIndex=0, the read property is: site=autorow|2|2|3|2|0, assuming that the site changes in increments according to the row, find instruction 3 from the preset rule file. Instruction 3 is an instruction to read data from the string array in increments of rows, specifically, it can refer to taking a value from a row in the string array, and automatically skipping n columns with a step length each time to take the next value until all items are output.
[0154] Here, the process of reading the data in the string array based on instruction 3 is similar to the process of reading the data in the string array based on instruction 2, which will not be repeated here.
[0155] In one example, if Figure 2 As shown in the figure, the process of extracting and dumping the files to be processed is described, including:
[0156] Step 201: Obtain the file to be processed;
[0157] Here, in actual application, in the message service scenario, the to-be-processed file may be a file storing multimedia messages generated by multiple communication servers of edge nodes in the form of Excel, etc. For example, an Excel file stores multimedia messages generated by communication server 1, communication server 2, and communication server 3. The multimedia messages generated by communication server 1 may be medical messages, the multimedia messages generated by communication server 2 may be political messages, and the multimedia messages generated by communication server 3 may be news messages.
[0158] Here, in the intelligent network data processing scenario, the to-be-processed file may be a file storing routing data generated by multiple communication servers of edge nodes in the form of Excel, etc. For example, an Excel file stores routing data generated by communication server 1, communication server 2, and communication server 3, and the routing data includes: IP address, port number, subnet mask, etc.
[0159] Step 202: storing the data in the to-be-processed file into a string array;
[0160] Step 203: determining at least two attributes of the string array; for each of the at least two attributes, determining whether the corresponding attribute satisfies a first preset condition; when it is determined that the corresponding attribute satisfies the first preset condition, executing step 204;
[0161] Step 204: taking the first instruction in the preset rule file as the instruction corresponding to the corresponding attribute; and extracting the data in the string array based on the first instruction.
[0162] The first instruction is an instruction for reading data from the string array according to a preset position.
[0163] Here, it is assumed that the to-be-processed file stores communication server 1, communication server 2, and routing data generated by the communication server. When it is necessary to extract the routing data in the to-be-processed file in batches and transfer it to communication server 2 in a configuration file of a specific format, the routing data in the to-be-processed file can be extracted in batches based on the preset rule file to obtain a configuration file corresponding to communication server 2. For example, there are 10 lines storing the IP address of communication server 2 in the to-be-processed file. Since the IP address of communication server 2 has not changed, the IP address corresponding to communication server 2 can be extracted from a preset fixed position in the to-be-processed file based on the first instruction in the preset rule file, and then the configuration file of communication server 2 is formed together with other extracted data.
[0164] Here, the string array and the preset rule file are combined to extract and dump the files to be processed, which has the following advantages:
[0165] (1) The application scenarios are relatively broad, and can be applied to message business scenarios and intelligent network data processing scenarios.
[0166] (2) Based on the string array, the data in the file to be processed is stored in a structured manner, and combined with the instructions for reading data at a preset location in the preset rule file, the automatic batch extraction and dumping of server data files based on the custom rule file is realized, and a configuration file is generated that can be directly recognized and read by the second server.
[0167] In actual application, considering that the values of the attributes stored in the string array need to be modified before they can be directly recognized and used by the server, the preset rule file can store instructions for modifying the extracted data.
[0168] Based on this, in one embodiment, searching for instructions corresponding to the corresponding attributes from the preset rule file includes:
[0169] Determining whether the corresponding attribute meets a second preset condition;
[0170] When it is determined that the corresponding attribute satisfies the second preset condition, taking the second instruction in the preset rule file as the instruction corresponding to the corresponding attribute;
[0171] The second instruction is an instruction capable of modifying the numerical value in the string array.
[0172] Here, the corresponding attribute satisfying the second preset condition may mean that a value corresponding to the corresponding attribute needs to be modified.
[0173] In actual application, the value corresponding to the attribute of the string array can be replaced by other numerical values, or other numerical values can be added to form a new numerical value. In this way, the corresponding data can be extracted using the instruction for modifying the extracted data.
[0174] Based on this, in one embodiment, the method further includes one of the following:
[0175] Based on the second instruction, extract the first data corresponding to the corresponding attribute in the string array; replace the first data with the second data; the second data is used to form a configuration file in a specific format;
[0176] Based on the second instruction, extract the first data corresponding to the corresponding attribute in the string array; combine the first data with preset data to obtain combined data; and use the combined data to form a configuration file in a specific format.
[0177] Table 3 is the correspondence between the attributes of the string array and the second instruction. As shown in Table 3, assuming that the value of the attribute of the string array needs to be added with other numerical values, instruction 10 is found from the preset rule file, and instruction 10 is used to extract the data in the string array; assuming that the value of the attribute of the string array needs to be set to a preset fixed value, instruction 5 is found from the preset rule file, and instruction 5 is used to extract the data in the string array; assuming that the value of the attribute of the string array needs to be replaced with other numerical values, instruction 12 is found from the preset rule file, and instruction 12 is used to extract the data in the string array.
[0178] String array properties Second Instruction Add other values to attribute values Instruction 10 (append) The attribute value is taken according to the fixed list loop Instruction 4 (list) The property value is set to a preset fixed value Instruction 5 (value) Replace the attribute value with another value Instruction 12 (read_accord)
[0179] Table 3
[0180] Taking instruction 4 as an example, the process of reading data from the string array based on the second instruction is described as follows:
[0181] Here, the attributes or attribute names of the string array can be read as follows:
[0182] Attribute name = list|item_1|item_2…|item_n
[0183] Assuming item_1 = 0xffff000a, item_2 = 0xffff000b, the attribute read is: value = list|0xffff000a|0xffff000b. Assuming that the value is displayed according to the loop list, instruction 4 is found from the preset rule file. Instruction 4 is an instruction for looping values according to a fixed list. Specifically, since the value of the attribute does not come from the database table corresponding to the string array or does not completely come from the database table corresponding to the string array, and the value of the attribute is variable, a list list can be specified, and the first item item_1 of the list stores the first attribute value read, and the second item item_2 stores the second attribute value read, and so on. There is no limit to the number of parameters stored in list, and the parameters can be irregular or regular parameters.
[0184] For example, the attribute parameter that is looped with a period of 2 includes 20 attribute values, the first attribute value = 0xffff000a, the second attribute value = 0xffff000b, and the third attribute value = 0xffff000a, and the loop continues until the last one is read.
[0185] Here, instruction 10 can be represented by append, which means adding a string after the value.
[0186] Taking instruction 5 as an example, the process of reading data from the string array based on the second instruction is described as follows:
[0187] Here, the attributes or attribute names of the string array can be read as follows:
[0188] Attribute name = value
[0189] Assuming value = 0x50000, the attribute read is: ID = 0x50000. Assuming that the value of the ID attribute needs to be set to a fixed value, instruction 5 is found from the preset rule file. Instruction 5 is an instruction for setting the value of the attribute to a fixed value. Specifically, the fixed value does not come from the database table corresponding to the string array, and can be a preset default value. For example, the value of the ID attribute is always 0x50000.
[0190] Here, the process of reading the data in the string array based on instruction 12 is similar to the process of reading the data in the string array based on instruction 5, which will not be repeated here. Instruction 12 can be represented by read_accord, indicating that the read value corresponds to another value.
[0191] In one example, if Figure 3 As shown in the figure, the process of extracting and dumping the files to be processed is described, including:
[0192] Step 301: Obtain the file to be processed;
[0193] Here, in actual application, in the message service scenario, the to-be-processed file may be a file storing multimedia messages generated by multiple communication servers of edge nodes in the form of Excel, etc. For example, an Excel file stores multimedia messages generated by communication server 1, communication server 2, and communication server 3. The multimedia messages generated by communication server 1 may be medical messages, the multimedia messages generated by communication server 2 may be political messages, and the multimedia messages generated by communication server 3 may be news messages.
[0194] Here, in the intelligent network data processing scenario, the to-be-processed file may be a file storing routing data generated by multiple communication servers of edge nodes in the form of Excel, etc. For example, an Excel file stores routing data generated by communication server 1, communication server 2, and communication server 3, and the routing data includes: IP address, port number, subnet mask, etc.
[0195] Step 302: storing the data in the to-be-processed file into a string array;
[0196] Step 303: determining at least two attributes of the string array; for each of the at least two attributes, determining whether the corresponding attribute satisfies a second preset condition; when it is determined that the corresponding attribute satisfies the second preset condition, executing step 304;
[0197] Step 304: taking the second instruction in the preset rule file as the instruction corresponding to the corresponding attribute; and extracting the data in the string array based on the second instruction.
[0198] The second instruction is an instruction capable of modifying the numerical value in the string array.
[0199] Here, it is assumed that the to-be-processed file stores communication server 1, communication server 2, and routing data generated by the communication server. When it is necessary to extract the routing data in the to-be-processed file in batches and transfer it to communication server 2 in a configuration file of a specific format, the routing data in the to-be-processed file can be extracted in batches based on the preset rule file to obtain a configuration file corresponding to communication server 2. For example, there are 10 lines storing the IP address of communication server 2 in the to-be-processed file. Since the deployment location of communication server 2 changes from location 1 to location 2, the IP address of communication server 2 changes. In this way, based on the second instruction in the preset rule file, the IP address corresponding to communication server 2 extracted from the to-be-processed file can be replaced with the IP address corresponding to location 2, and subsequently the configuration file of communication server 2 is formed together with other extracted data.
[0200] Here, the string array and the preset rule file are combined to extract and dump the files to be processed, which has the following advantages:
[0201] (1) The application scenarios are relatively broad, and can be applied to message business scenarios and intelligent network data processing scenarios.
[0202] (2) Based on the string array, the data in the file to be processed is stored in a structured manner, and combined with the instructions for modifying the data in the preset rule file, the automatic batch extraction and dumping of server data files based on the custom rule file is realized, and a configuration file is generated that can be directly recognized and read by the second server.
[0203] In actual application, considering that the value of the attribute stored in a cell in the string array needs to be combined, calculated, and processed with the values of the attributes stored in other cells before it can be directly recognized and used by the server, the preset rule file can store instructions for block structure combination and calculation of the extracted data.
[0204] Based on this, in one embodiment, searching for an instruction corresponding to the attribute from a preset rule file includes:
[0205] Determine whether the corresponding attribute satisfies a third preset condition; when it is determined that the corresponding attribute satisfies the third preset condition, use the third instruction in the preset rule file as an instruction corresponding to the corresponding attribute; wherein the third instruction is an instruction for processing data of at least two cells in the string array.
[0206] Here, the corresponding attribute satisfying the third preset condition may mean that a value corresponding to the corresponding attribute needs to be combined or calculated with values of other attributes.
[0207] In actual application, if the attribute value corresponding to a cell of the string array needs to be merged with the attribute values corresponding to other cells, the data in the string array can be read using an instruction for reading data according to a block structure; if the attribute value corresponding to a cell of the string array needs to be calculated using the attribute values corresponding to other cells, the data in the string array can be read using an instruction for calculating the extracted data.
[0208] Based on this, in one embodiment, the method further includes one of the following:
[0209] Based on the third instruction, the first data corresponding to the corresponding attribute and the third data corresponding to other attributes in the string array are merged, and the merged data is extracted; the merged data is used to form a configuration file in a specific format;
[0210] Based on the second instruction, the first data corresponding to the corresponding attribute and the fourth data corresponding to other attributes in the string array are operated, and the operated data are extracted; the operated data are used to form a configuration file in a specific format.
[0211] Table 4 is the correspondence between the attributes of the string array and the third instruction. As shown in Table 4, assuming that the value of the attribute of the string array needs to be merged with the value of other attributes, instruction 6, instruction 7, and instruction 8 are found from the preset rule file, and instruction 6 or instruction 7 or instruction 8 are used to extract the data in the string array; assuming that the value of the attribute of the string array needs to be calculated with the value of other attributes, instruction 9 is found from the preset rule file, and instruction 9 is used to extract the data in the string array.
[0212]
[0213] Table 4
[0214] Here, instruction 6 can be represented by read_block, which means reading the data in the string array according to the block structure. The block structure can refer to the block structure obtained by merging multiple cells in the string array. Instructions 7 and 8 can be represented by read_ip / read_port respectively, which means the instructions for merging the read IP and port addresses. Instruction 9 can be represented by command, which means the instruction for executing calculation / command.
[0215] In one example, if Figure 4 As shown in the figure, the process of extracting and dumping the files to be processed is described, including:
[0216] Step 401: Obtain the file to be processed;
[0217] Here, in actual application, in the message service scenario, the to-be-processed file may be a file storing multimedia messages generated by multiple communication servers of edge nodes in the form of Excel, etc. For example, an Excel file stores multimedia messages generated by communication server 1, communication server 2, and communication server 3. The multimedia messages generated by communication server 1 may be medical messages, the multimedia messages generated by communication server 2 may be political messages, and the multimedia messages generated by communication server 3 may be news messages.
[0218] Here, in the intelligent network data processing scenario, the to-be-processed file may be a file storing routing data generated by multiple communication servers of edge nodes in the form of Excel, etc. For example, an Excel file stores routing data generated by communication server 1, communication server 2, and communication server 3, and the routing data includes: IP address, port number, subnet mask, etc.
[0219] Step 402: storing the data in the to-be-processed file into a string array;
[0220] Step 403: determining at least two attributes of the string array; for each of the at least two attributes, determining whether the corresponding attribute satisfies a third preset condition; when it is determined that the corresponding attribute satisfies a second preset condition, executing step 404;
[0221] Step 404: taking the third instruction in the preset rule file as the instruction corresponding to the corresponding attribute; and extracting the data in the string array based on the third instruction.
[0222] The third instruction is an instruction for processing data of at least two cells in the string array.
[0223] Here, it is assumed that the to-be-processed file stores communication server 1, communication server 2, and routing data generated by the communication server. When it is necessary to extract the routing data in the to-be-processed file in batches and transfer it to communication server 2 in a configuration file of a specific format, the routing data in the to-be-processed file can be extracted in batches based on the preset rule file to obtain a configuration file corresponding to communication server 2. For example, the to-be-processed file stores the IP address, port number, and subnet mask of communication server 2. Since the cells corresponding to the IP address, port number, and subnet mask can be merged, the content of the merged cell can be extracted from the to-be-processed file based on the third instruction in the preset rule file, that is, the three data of IP address, port number, and subnet mask can be extracted at the same time, and subsequently form the configuration file of communication server 2 together with other extracted data.
[0224] Here, the string array and the preset rule file are combined to extract and dump the files to be processed, which has the following advantages:
[0225] (1) The application scenarios are relatively broad, and can be applied to message business scenarios and intelligent network data processing scenarios.
[0226] (2) Based on the string array, the data in the file to be processed is stored in a structured manner, and combined with the instructions for merging and calculating the data in the preset rule file, the automatic batch extraction and dumping of server data files based on the custom rule file is realized, and a configuration file is generated that can be directly recognized and read by the second server.
[0227] In actual application, considering that only some of the attribute values stored in the string array can be directly recognized and used by the server, the preset rule file can store instructions for intercepting and extracting data in the string array.
[0228] Based on this, in one embodiment, searching for an instruction corresponding to the attribute from a preset rule file includes:
[0229] Determining whether the corresponding attribute meets a fourth preset condition;
[0230] When it is determined that the corresponding attribute satisfies a fourth preset condition, taking the fourth instruction in the preset rule file as an instruction corresponding to the corresponding attribute;
[0231] The fourth instruction is an instruction for intercepting and reading the data in the character string array.
[0232] Here, the corresponding attribute satisfying the fourth preset condition may mean that the corresponding attribute contains specific characters, such as an end character, a jump character, and the like.
[0233] Table 5 is the correspondence between the attributes of the string array and the fourth instruction. As shown in Table 5, if the attribute of the string array contains a jump character, instruction 10 is found from the preset rule file, and instruction 10 is used to jump to other positions in the string array for reading; if the attribute of the string array contains an end character, instruction 11 is found from the preset rule file, and instruction 11 is used to end data reading. Instruction 10 can be represented by read_jumpif, indicating that it jumps when this value is read; instruction 11 can be represented by read_exterminate, indicating that it is forced to end when it is read.
[0234] String array properties Third Instruction Attribute contains jump characters Instruction 10 (read_jumpif) The attribute contains the ending character Instruction 11 (read_exterminate)
[0235] Table 5
[0236] Figure 5 : is a schematic diagram of a system framework for the application of the file processing method according to an embodiment of the present invention, wherein the system comprises:
[0237] The first server 51 includes a reading module and a parsing module; wherein the reading module is responsible for reading a plurality of files to be processed and storing them into a four-dimensional string array. Specifically, a loop nesting method can be used to read the files to be processed into the four-dimensional string array, such as Figure 6 The parsing module is used to read the preset rule file, load the corresponding instructions to extract the data in the four-dimensional string array, and output the configuration file in a specific format to the second server. The code structure executed by the parsing module is as follows Figure 7 shown.
[0238] The second server 52 is used to receive the configuration file in a specific format sent by the first server.
[0239] In one example, if Figure 8 As shown, combined Figure 5 The system architecture diagram shown in the figure describes the process of automatically extracting and dumping data from the files to be processed, including:
[0240] Step 801: Batch read Excel data in the file to be processed into a four-dimensional string array.
[0241] Here, first, the user loads the Excel data in the to-be-processed file of the first server to extract data. If the extraction rules are consistent, multiple batches can be processed. Then, all Excel data in the to-be-processed file of the first server are read into the memory in a structured manner, that is, stored in a four-dimensional string array, and the four dimensions of the four-dimensional string array are workbook Workbook-> data table Sheet-> cell row value and column value Column&Row.
[0242] Here, taking the case where the file to be processed is a database file in a media processing communication server as an example, the reading module in the first server stores the file to be processed in a string array, as shown in Table 6.
[0243]
[0244] Table 6
[0245] Step 802: Extract and dump the data in the four-dimensional string array according to the preset rule file.
[0246] Here, the preset rule file is read, the data of each cell (Cell) in the four-dimensional string array is sorted according to the preset rule file, and the data is output as a configuration file that can be directly read and used by the second server.
[0247] Here, the preset rule file defines how to extract and dump, that is, how to read attribute information from multiple communication server data files and generate text in a specified format. The content of the preset rule file may include:
[0248] Initialization mark: The initialization mark defines the beginning / end of the rule file and defines the initialization setting parameters. The initialization mark is marked with "#". Example: #rf_start (beginning of the rule file) #rf_end (end of the rule file); Example: #init|param1|param2|param3|param4|... (determine the initialization settings and parameters)
[0249] Attribute: Each cell data in an Excel table has a name, such as the income data in a financial report, the attribute is income, and the value is the cell content. In the rule file, you can define the name of the attribute and the source of the attribute.
[0250] Comments: Lines starting with a semicolon are skipped by rule parsing and are considered comments.
[0251] Instruction: The instruction solves the problem of how to get the value of this attribute from the communication server data file. The format of the instruction is as follows: attribute name = instruction name | instruction parameter 1 | 2 | 3...
[0252] Here, the preset rule file used by the parsing module in the first server is as follows:
[0253] #rf_start
[0254] #init|none
[0255] Device: read_block(device port = autocolumn|2|1|0|0|1, IP address == autocolumn|2|2|0|0|1, local port number = autocolumn|2|3|0|0|1, gateway = autocolumn|2|4|0|0|1, subnet mask = autocolumn|2|5|0|0|1)
[0256] #rf_end
[0257] Output:
[0258] Device: (Device port = 1-A, IP address = 172.155.20.15, local port number = 2007, gateway = 172.155.20.1, subnet mask = 255.255.255.0)
[0259] Device: (Device port = 1-A, IP address = 172.155.20.15, local port number = 2007, gateway = 172.155.20.1, subnet mask = 255.255.255.0)
[0260] Device: (Device port = 1-B, IP address = 172.155.21.15, local port number = 2007, gateway = 172.155.20.1, subnet mask = 255.255.255.0)
[0261] Device: (Device port = 1-B, IP address = 172.155.21.15, local port number = 2007, gateway = 172.155.20.1, subnet mask = 255.255.255.0)
[0262] The following is the actual output configuration file and the corresponding extracted comment interception:
[0263] [CONN2_GLOBAL]
[0264] main_cycle=500
[0265] ; Fixed value 500
[0266] ;main_cycle=500
[0267] connection_num=80
[0268] ; This is a calculated value, the calculation rule is: sum (number of connections to each server), so it is defined as a constant (connection_num)
[0269] ;connection_num = con_num
[0270] net_task_num=1
[0271] ; This is a calculated value, so it is defined as a constant (task_num)
[0272] ;net_task_num=task_num
[0273] EDGE_ID = 0x01
[0274] ; This is a fixed value 0x01
[0275] local_NODE_ID=0x8504001
[0276] ; This value comes from the central device number hexadecimal cell in table 0, and is read using instruction 1, i.e., the xls instruction
[0277] ;xls|9|28|2|0
[0278] local_NODE_ID_type=0x07
[0279] ; This value comes from the type number cell in table 0 and is read using instruction 1, the xls instruction
[0280] ; Source address ASNODE A series
[0281] source_addr = 0x4001
[0282] ;xls|12|28|2|0
[0283] ; From the security parameter table ASNODE security protocol verification source address
[0284] ; From the safety parameter table, this can be directly read using instruction 1, i.e. xls instruction
[0285] local_dataVer_A=0xe12ad264
[0286] ;xls|15|28|2|0
[0287] local_dataVer_B = 0x325d0266
[0288] ;xls|16|28|2|0
[0289] local_sinit_A=0x5adce268
[0290] ;xls|17|28|2|0
[0291] local_sinit_B=0x5debb26a
[0292] ;xls|18|28|2|0
[0293] local_sid_A=0xc53a626c
[0294] ;xls|19|28|2|0
[0295] local_sid_B = 0x980d526e
[0296] ;xls|20|28|2|0
[0297] local_sys_chk_A=0xae390b5a
[0298] local_sys_chk_B=0xc103589c
[0299] ; Fixed value 0, just use the attribute name + fixed value in the rule file
[0300] local_crc32_poly_value_A=0
[0301] local_crc32_poly_value_B=0
[0302] local_LFSR_poly_value_A=0
[0303] local_LFSR_poly_value_B=0
[0304] ; Fixed value, just use the attribute name + fixed value in the rule file
[0305] SFM_U2L_Q_Size_per_connection=200
[0306] SFM_L2U_Q_Size_per_connection=200
[0307] CFM_U2L_Q_Size_per_connection=500
[0308] CFM_L2U_Q_Size_per_connection=500
[0309] ; From the structural point of view, this file is a node divided into 4 sub-links
[0310] ; The number of child links output by each node can be defined. When outputting, just insert a line in the configuration file
[0311] ;1\2\4(#con_output|1|1|1|2|4|2|1|2|2|2|4|...)
[0312] [CON_0]
[0313] EDGE_ID = 0x00
[0314] ; EDGE_ID is a fixed value of 0x00
[0315] NODE_ID = 0x73E4101
[0316] ; The autocolumn function can realize automatic reading
[0317] ;autocolumn|9|4|1|2|0
[0318] NODE_IdType=0x06
[0319] ; Fixed value, specified as 0x06, always use this value
[0320] CONN_comm_cycle = 0
[0321] ; Fixed value
[0322] ; Destination address A-red
[0323] dest_addr = 0x4101
[0324] ;autocolumn|17|4|1|2|0|0
[0325] enable_CRSCD_pack=0
[0326] ; 0 default value, if there is a change, you can use command 4, i.e. list command, to extract deltaTime=5 in the preset rule file
[0327] lifeTime=5
[0328] torlerate_cycle=6
[0329] num_data_ver=1
[0330] ; all take fixed values and remain unchanged
[0331] remote_dataVer_A=0x2923b004
[0332] ;autocolumn|20|4|1|2|0|0
[0333] remote_dataVer_B = 0xe16cd006
[0334] ;autocolumn|21|4|1|2|0|0
[0335] remote_sinit_A=0x52904008
[0336] ;autocolumn|22|4|1|2|0|0
[0337] remote_sinit_B = 0xf1bbe00a
[0338] ;autocolumn|23|4|1|2|0|0
[0339] remote_sid_A=0xb3a6d00c
[0340] ;autocolumn|24|4|1|2|0|0
[0341] remote_sid_B=0x870c300e
[0342] ;autocolumn|25|4|1|2|0|0
[0343] com_type=0
[0344] ; are all default values
[0345] check_idle_cycle=40
[0346] maintain_cycle=50
[0347] packet_send_delay=5
[0348] enable_UDP_chn_CONN=1
[0349] UDP_chn_apply_CONN_ID=4001
[0350] con_L2U_Q_size=2
[0351] UDP_channel_num=1
[0352] ;default value
[0353] local_ip_0 = 172.155.20.120
[0354] ; Corresponding extraction rules: xls|4|4|6|1
[0355] local_port_0=5001
[0356] ; Corresponding extraction rules: xls|5|4|6|1
[0357] remote_ip_0 = 172.155.20.15
[0358] ; Due to confusion in order, first output according to A-red-B-red A-blue B-blue 1-A, 2-A, 1-B, 2-B, put it in a StationSettings, and then you can output it as needed
[0359] ; Corresponding extraction rules: autocolumn|4|4|2|2|1|1
[0360] ; Since each CON of remote_ip has a corresponding one, set the stepWait attribute to 1
[0361] remote_port_0=2007
[0362] ;autocolumn|5|4|2|2|1|1
[0363] ; The following are all default values, unchanged, take fixed values
[0364] sock_send_buf_size=60000
[0365] sock_recv_buf_size=60000
[0366] UDP_recv_MQ_size=5
[0367] UDP_send_MQ_size=5
[0368] com_channel_num=1
[0369] com_port_0=1
[0370] Baud_rate = 38400
[0371] scom_send_MQ_size=5
[0372] scom_recv_MQ_size=5
[0373] scom_recv_buf_size=2048
[0374] [CON_1]
[0375] EDGE_ID = 0x00
[0376] NODE_ID = 0x73E4101
[0377] NODE_IdType = 0x06
[0378] CONN_comm_cycle = 0
[0379] ; Destination address B red
[0380] dest_addr = 0x4101
[0381] enable_CRSCD_pack = 0
[0382] deltaTime = 5
[0383] lifeTime = 5
[0384] torlerate_cycle = 6
[0385] num_data_ver = 1
[0386] remote_dataVer_A = 0x2923b004
[0387] remote_dataVer_B = 0xe16cd006
[0388] remote_sinit_A = 0x52904008
[0389] remote_sinit_B = 0xf1bbe00a
[0390] remote_sid_A = 0xb3a6d00c
[0391] remote_sid_B = 0x870c300e
[0392] com_type = 0
[0393] check_idle_cycle = 40
[0394] maintain_cycle = 50
[0395] packet_send_delay = 5
[0396] enable_UDP_chn_CONN = 1
[0397] UDP_chn_apply_CONN_ID = 4001
[0398] con_L2U_Q_size=2
[0399] UDP_channel_num=1
[0400] local_ip_0 = 172.155.20.120
[0401] local_port_0=5001
[0402] remote_ip_0 = 172.155.20.16
[0403] remote_port_0=2007
[0404] sock_send_buf_size=60000
[0405] sock_recv_buf_size=60000
[0406] UDP_recv_MQ_size=5
[0407] UDP_send_MQ_size=5
[0408] com_channel_num=1
[0409] com_port_0=1
[0410] Baud_rate = 38400
[0411] scom_send_MQ_size=5
[0412] scom_recv_MQ_size=5
[0413] scom_recv_buf_size=2048
[0414] By adopting the technical solution provided in the embodiment of the present invention, the data in the file to be processed is structuredly stored through a string array, and combined with a preset rule file, the data in the file to be processed is batch extracted and transferred to the second server in a configuration file in a specific format, thereby realizing automatic extraction and dumping of data, saving time and effort, and having high efficiency.
[0415] In order to implement the file processing method of the embodiment of the present invention, the embodiment of the present invention also provides a file processing device, Fig. 9 FIG. 1 is a schematic diagram of the structure of a file processing device according to an embodiment of the present invention; Fig. 9 As shown, the device comprises:
[0416] An acquisition unit 91 is used to acquire a file to be processed; the file to be processed is a file formed by multimedia messages or routing data generated by multiple communication servers of the edge node;
[0417] A first processing unit 92 is used to store the data in the to-be-processed file into a string array;
[0418] The second processing unit 93 is used to read a preset rule file; use the preset rule file to extract the data in the string array to form a configuration file in a specific format; the configuration file is used for the second server to identify and use.
[0419] In one embodiment, the second processing unit 93 is specifically configured to:
[0420] Determining at least two properties of the string array;
[0421] For each of the at least two attributes, searching the preset rule file for an instruction corresponding to the corresponding attribute to obtain at least two instructions; the preset rule file stores a correspondence between the attribute and the instruction;
[0422] Based on the at least two instructions, data in the string array is extracted.
[0423] In one embodiment, the second processing unit 93 is specifically used to: determine whether the corresponding attribute meets the first preset condition;
[0424] When it is determined that the corresponding attribute satisfies the first preset condition, taking the first instruction in the preset rule file as the instruction corresponding to the corresponding attribute;
[0425] The first instruction is an instruction for reading data from the string array according to a preset position.
[0426] In one embodiment, the second processing unit is further configured to perform one of the following operations:
[0427] Based on the first instruction, read data from a fixed position of the string array;
[0428] Based on the first instruction, read data from the string array in a row-by-row increment manner;
[0429] Based on the first instruction, data is read from the string array in a column-increasing manner.
[0430] In addition, according to at least one embodiment of the present invention, the second processing unit 93 is specifically configured to:
[0431] Determining whether the corresponding attribute meets a second preset condition;
[0432] When it is determined that the corresponding attribute satisfies the second preset condition, taking the second instruction in the preset rule file as the instruction corresponding to the corresponding attribute;
[0433] The second instruction is an instruction capable of modifying the numerical value in the string array.
[0434] In one embodiment, the second processing unit 93 is further configured to perform one of the following operations:
[0435] Based on the second instruction, extract the first data corresponding to the corresponding attribute in the string array; replace the first data with the second data; the second data is used to form a configuration file in a specific format;
[0436] Based on the second instruction, extract the first data corresponding to the corresponding attribute in the string array; combine the first data with preset data to obtain combined data; and use the combined data to form a configuration file in a specific format.
[0437] In one embodiment, the second processing unit 93 is specifically configured to:
[0438] Determining whether the corresponding attribute meets a third preset condition;
[0439] When it is determined that the corresponding attribute satisfies the third preset condition, taking the third instruction in the preset rule file as the instruction corresponding to the corresponding attribute;
[0440] The third instruction is an instruction for processing data of at least two cells in the string array.
[0441] In one embodiment, the second processing unit 93 is further configured to perform one of the following operations:
[0442] Based on the third instruction, the first data corresponding to the corresponding attribute and the third data corresponding to other attributes in the string array are merged, and the merged data is extracted; the merged data is used to form a configuration file in a specific format;
[0443] Based on the second instruction, the first data corresponding to the corresponding attribute and the fourth data corresponding to other attributes in the string array are operated, and the operated data are extracted; the operated data are used to form a configuration file in a specific format.
[0444] In actual application, the acquisition unit 91 can be implemented by a communication interface in a file processing device; the first processing unit 92 and the second processing unit 93 can be implemented by a processor in the file processing device.
[0445] It should be noted that: the file processing device provided in the above embodiment only uses the division of the above program modules as an example to illustrate when performing file processing. In actual applications, the above processing can be assigned to different program modules as needed, that is, the internal structure of the device is divided into different program modules to complete all or part of the processing described above. In addition, the file processing device provided in the above embodiment and the file processing method embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be repeated here.
[0446] The embodiment of the present invention also provides a communication device, such as Fig.10 As shown, including:
[0447] Communication interface 101, capable of exchanging information with other devices;
[0448] The processor 102 is connected to the communication interface 101 and is used to execute the method provided by one or more technical solutions on the smart device side when running the computer program. The computer program is stored in the second memory 103.
[0449] It should be noted that the specific processing process of the processor 102 and the communication interface 101 is detailed in the method embodiment and will not be repeated here.
[0450] Of course, in actual application, the various components in the communication device 100 are coupled together through the bus system 104. It can be understood that the bus system 104 is used to realize the connection and communication between these components. In addition to the data bus, the bus system 104 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, Fig.10 Various buses are labeled as bus system 104 .
[0451] The memory 103 in the embodiment of the present application is used to store various types of data to support the operation of the communication device 100. Examples of such data include: any computer program used to operate on the communication device 100.
[0452] The method disclosed in the above embodiment of the present application can be applied to the processor 102, or implemented by the processor 102. The processor 102 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by an integrated logic circuit of the hardware in the processor 102 or an instruction in the form of software. The above-mentioned first processor 102 may be a general-purpose processor, a digital signal processor (DSP, Digital Signal Processor), or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The processor 102 can implement or execute the methods, steps and logic block diagrams disclosed in the embodiments of the present application. A general-purpose processor may be a microprocessor or any conventional processor, etc. In combination with the steps of the method disclosed in the embodiment of the present application, it can be directly embodied as a hardware decoding processor to execute, or it can be executed by a combination of hardware and software modules in the decoding processor. The software module can be located in a storage medium, which is located in the memory 103, and the processor 102 reads the information in the memory 103 and completes the steps of the above method in combination with its hardware.
[0453] In an exemplary embodiment, the communication devices 100, 100 may be implemented by one or more application specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field programmable gate arrays (FPGAs), general-purpose processors, controllers, microcontrollers (MCUs), microprocessors, or other electronic components to perform the aforementioned method.
[0454] It can be understood that the memory (first memory 103) of the embodiment of the present application can be a volatile memory or a non-volatile memory, and can also include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a magnetic random access memory (FRAM), a flash memory, a magnetic surface memory, an optical disc, or a compact disc read-only memory (CD-ROM); the magnetic surface memory can be a disk memory or a tape memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM), synchronous static random access memory (SSRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM, SyncLink Dynamic Random Access Memory), and direct RAMbus random access memory (DRRAM, Direct Rambus Random Access Memory).The memories described in the embodiments of the present application are intended to include, but are not limited to, these and any other suitable types of memories.
[0455] In an exemplary embodiment, the embodiment of the present invention further provides a storage medium, namely a computer storage medium, specifically a computer-readable storage medium, for example, including a first memory 103 storing a computer program, and the computer program can be executed by the first processor 102 of the communication device 100 to complete the steps of the aforementioned control server side method. The computer-readable storage medium can be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, Flash Memory, magnetic surface storage, optical disk, or CD-ROM.
[0456] It should be noted that: "first", "first", etc. are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0457] In addition, the technical solutions described in the embodiments of the present invention can be arbitrarily combined without conflict.
[0458] The above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention.
Claims
1. A file processing method, characterized in that: Applied to a first server, the method comprises: Acquire a file to be processed; the file to be processed is a file formed by multimedia messages or routing data generated by multiple communication servers of the edge node; The data in the to-be-processed file is stored in a string array, wherein the data stored in the string array is composed of attributes and attribute values; Reading a preset rule file, wherein the preset rule file stores a variety of instructions; The preset rule file is used to extract data in the string array using instructions corresponding to the attributes of the string array to form a configuration file in a specific format; the configuration file is used to be identified and used by the second server.
2. The method according to claim 1, characterized in that The method of using a preset rule file and using instructions corresponding to the attributes of the string array to extract data from the string array includes: Determining at least two properties of the string array; For each of the at least two attributes, searching the preset rule file for an instruction corresponding to the corresponding attribute to obtain at least two instructions; the preset rule file stores a correspondence between the attribute and the instruction; Based on the at least two instructions, data in the string array is extracted.
3. The method according to claim 2, characterized in that The step of searching the preset rule file for instructions corresponding to the corresponding attributes includes: Determining whether the corresponding attribute meets a first preset condition; When it is determined that the corresponding attribute satisfies the first preset condition, taking the first instruction in the preset rule file as the instruction corresponding to the corresponding attribute; The first instruction is an instruction for reading data from the string array according to a preset position.
4. The method according to claim 3, characterized in that The method further comprises one of the following: Based on the first instruction, read data from a fixed position of the string array; Based on the first instruction, read data from the string array in a row-by-row increment manner; Based on the first instruction, data is read from the string array in a column-increasing manner.
5. The method according to claim 2, characterized in that: The step of searching the preset rule file for instructions corresponding to the corresponding attributes includes: Determining whether the corresponding attribute meets a second preset condition; When it is determined that the corresponding attribute satisfies the second preset condition, taking the second instruction in the preset rule file as the instruction corresponding to the corresponding attribute; The second instruction is an instruction capable of modifying the numerical value in the string array.
6. The method according to claim 5, characterized in that The method further comprises one of the following: Based on the second instruction, extract the first data corresponding to the corresponding attribute in the string array; replace the first data with the second data; the second data is used to form a configuration file in a specific format; Based on the second instruction, extract the first data corresponding to the corresponding attribute in the string array; combine the first data with preset data to obtain combined data; and use the combined data to form a configuration file in a specific format.
7. The method according to claim 2, characterized in that The step of searching the preset rule file for the instruction corresponding to the attribute includes: Determining whether the corresponding attribute meets a third preset condition; When it is determined that the corresponding attribute satisfies the third preset condition, taking the third instruction in the preset rule file as the instruction corresponding to the corresponding attribute; The third instruction is an instruction for processing data of at least two cells in the string array.
8. The method according to claim 7, characterized in that The method further comprises one of the following: Based on the third instruction, merge the first data corresponding to the corresponding attribute and the third data corresponding to other attributes in the string array, and extract the merged data; The merged data is used to form a configuration file in a specific format; Based on the second instruction, the first data corresponding to the corresponding attribute and the fourth data corresponding to the other attributes in the string array are operated, and the operated data are extracted; the operated data are used to form a configuration file in a specific format; wherein the second instruction is an instruction capable of modifying the numerical value in the string array.
9. A file processing device, characterized in that: include: An acquisition unit, used for acquiring files to be processed; The to-be-processed file is a file formed by multimedia messages or routing data generated by multiple communication servers of the edge node; A first processing unit is used to store the data in the to-be-processed file into a string array, wherein the data stored in the string array consists of attributes and attribute values; The second processing unit is used to read a preset rule file; using the preset rule file, using instructions corresponding to the attributes of the string array to extract data in the string array to form a configuration file in a specific format; the configuration file is used for the second server to identify and use; wherein the preset rule file stores a variety of instructions.
10. An electronic device, characterized in that: include: A communication interface for obtaining files to be processed; The to-be-processed file is a file formed by multimedia messages or routing data generated by multiple communication servers of the edge node; A processor, used for storing the data in the to-be-processed file into a string array; And read a preset rule file; use the preset rule file to extract the data in the string array using instructions corresponding to the attributes of the string array to form a configuration file in a specific format; the data stored in the string array is composed of attributes and attribute values, the preset rule file stores multiple instructions, and the configuration file is used for the second server to identify and use.
11. A communication device, characterized in that: comprising a processor and a memory for storing a computer program capable of being executed on the processor, Wherein, when the processor is used to run the computer program, it executes the steps of the method described in any one of claims 1 to 8.
12. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.
