5
I’m trying to find a way to assemble a table with the data of a txt, but I don’t know how to separate the values in the array, since they are separated by several spaces, but are identified by fields (Name: , Code: , ...);
Example of a txt file:
Código: 808 Nome Abreviado: 091/0007756 Cliente Cobrança: 808
Nome: Nome da empresa Representante: 8
Endereço: AV.2422 Bairro: Jardim
Cidade: Jacare UF: SP Caixa Postal:
País: BRASIL CEP: 12222222 Zip Code:
Telefone[1]: 00-0000-0000 Telex: CGC/CPF: 123.321.123.4
Ramo Atividade: Grupo: 99 Data Implantação: 03/09/2007
Categoria: Inscrição Municipal:
Inscrição Estadual: 111.222.333.-74
E-mail: [email protected]
Each field is in a row or there is a character limitation per column?
– rray
The fields are online, exactly the way it is in the post, in the first line has the Code, abbreviated name and client, in the next has the Name, representative and so on. What you have in common among the fields is :.
– Thiago
I find it difficult a parser for this case, how to define the end of the field and start of the next one? There are tabulations for the separation of fields?
– gmsantos
The worst part is, it doesn’t exist. I did a test here and even gave to separate the fields based on :, which resulted in:Array ( [0] => Code [1] => 747 Abbreviated Name [2] => 2M Customer Billing [3] => 747 )
– Thiago
The array cannot be exactly the
nome dos campos
+:
and then give a Trim in the content that is between this? It’s just an idea that came in my imagination !!!– Marcos Vinicius
checks the pattern used by the program q exported this file, then applies reverse engineering
– William Borba
This is a bank shipping file ?
– Fábio Lemos Elizandro
Yes, this is a result of a program that queries in database, but not know how it works, my access to it is limited only to the result that is txt file.
– Thiago
If possible, post an example of functional code you have used, helps a lot to formulate a response.
– g.carvalho97
@Thiago if this is a shipping or bank return file you are picking up the wrong file, this file is not made for machines, any parse there is uniform to fail since some name may have ":" or two spaces and there is no marking or escape character. I suggest you contact the bank to know how to recover the correct file.
– Fábio Lemos Elizandro