LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how to import text out of .txt file and put/sort them in a libre office tables? (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-import-text-out-of-txt-file-and-put-sort-them-in-a-libre-office-tables-4175574553/)

webodin 03-10-2016 04:29 PM

how to import text out of .txt file and put/sort them in a libre office tables?
 
How do i import text bellow from text file (large .txt file) and
sort to libreoffice or comma separate file,
is there any way to do it ? or simple script or example?

_________________________________________
235603: ** vpbx001
** REPORT : CTID=002, NAME=customer1 **

errorcount,barrier,limit
0,1.7,2.7
0,1.7,2.7

== END ==
________________________________________
** REPORT : CTID=003, NAME=customer2 **

errorcount,barrier,limit
0,17.2,27.0
PROBLEM: 2255726,17.2,27.0

== END ==
________________________________________
235603: ** vpbx3
** REPORT : CTID=18, NAME=customer3 **

errorcount,barrier,limit
0,1.7,2.7
PROBLEM: 1,1.7,2.7

== END ==
________________________________________
** REPORT : CTID=82, NAME=customer4 **
** REPORT : CTID=25, NAME=customer5 **

errorcount,barrier,limit
0,1.7,2.7
0,1.7,2.7

== END ==
__________________________________________
errorcount,barrier,limit
0,1.7,2.7
0,1.7,2.7

== END ==
_______________________________________
235603: ** vpbx14
235603: ** vpbx18
** REPORT : CTID=47, NAME=customer6 **

** REPORT : CTID=30, NAME=cutomer7 **

errorcount,barrier,limit
0,1.7,2.7
0,1.7,2.7

== END ==
________________________________________
** REPORT : CTID=15, NAME=customer8 **

errorcount,barrier,limit
0,1.7,2.7
PROBLEM: 289,1.7,2.7

== END ==
________________________________________
errorcount,barrier,limit
0,1.7,2.7
problem 2500,1.7,2.7

== END ==
________________________________________
235603: ** vpbx12
** REPORT : CTID=81, NAME= **

errorcount,barrier,limit
0,1.7,2.7
PROBLEM: 111,1.7,2.7

== END ==
_________________________________________

the way the text could be imported and separate in libreoffice
tables like example below ....

vpbxXX | CTID=XX | NAME=XXXXX | 0,1.7,2.7 | PROBLEM: 289,1.7,2.7

do any sitting with already solution please help..

hydrurga 03-10-2016 05:46 PM

A problem you are going to face is that your input data is not consistent i.e. the data placement is not exactly the same in each record.

For example:

Code:

_________________________________________
235603: ** vpbx14
235603: ** vpbx18
** REPORT : CTID=47, NAME=customer6 **

** REPORT : CTID=30, NAME=cutomer7 **

at the start of one record, and

Code:

__________________________________________
errorcount,barrier,limit
0,1.7,2.7
0,1.7,2.7

at another are completely different.

You are either going to have to get your input data consistent (by perhaps changing the report generator) to make things easier, or take account of all the variances in the programming language, e.g. Python, that you use.

webodin 03-11-2016 04:27 AM

how it will "vzubc" command look like
if i wanna read "CT" "tcp*" and FAIL

----------------------------------------------------------------
CT XXX | HELD Bar% Lim%| MAXH Bar% Lim%| BAR | LIM | FAIL
-------------+---------------+---------------+-----+-----+------
kmemsize|16.6M 34% 31%|36.1M 75% 68%|47.7M|52.5M| -
lockedpages| - - - | - - - | 8M| 8M| -
privvmpages| 953M 46% 43%|1.26G 63% 59%| 2G|2.12G| -
shmpages| 4K - - | 8K - - | 84M| 84M| -
numproc| 108 5% 5%| 270 13% 13%| 2K| 2K| -
physpages| 644M - - |1.01G - - | - | - | -
vmguarpages| - - - | - - - | 132M| - | -
oomguarpages| 442M 433% - | 491M 482% - | 102M| - | -
numtcpsock| 123 12% 12%| 169 16% 16%| 1K| 1K| -
numflock| 6 3% 2%| 14 7% 6%| 188 | 206 | -
numpty| 2 12% 12%| 3 18% 18%| 16 | 16 | -
numsiginfo| 1 0.4% 0.4%| 39 15% 15%| 256 | 256 | -
tcpsndbuf| 718K 42% 27%|1.32M 80% 51%|1.64M|2.58M| -
tcprcvbuf| 208K 12% 7%|1.65M 100% 63%|1.64M|2.58M| 29

othersockbuf|54.2K 0.6% 0.5%| 865K 8% 8%|9.54M|10.5M| -
dgramrcvbuf| - - - | 161K 1% 1%| 16M| 16M| -
numothersock| 70 2% 2%| 213 5% 5%| 4K| 4K| -
dcachesize|5.99M 62% 31%|19.1M 200% 100%|9.54M|19.1M| -
numfile|1.19K 2% 2%|2.15K 3% 3%| 64K| 64K| -
numiptent| 4 3% 3%| 4 3% 3%| 128 | 128 | -

grail 03-11-2016 05:30 AM

Please use [code][/code] tags when showing code or data.

I am not sure how your latest post and the first one are related?
I can tell you that if the last post with pipe separated data is what you have then you should be able to simply import and then remove the unwanted columns.

allend 03-11-2016 06:00 AM

It looks as though the OP is trying to gather information from an OpenVZ setup.
Rather than scripting to transform the output, perhaps the OP would do better to get the information out in the desired format. This script may provide some ideas. https://openvz.org/UBC_failcnt_reset...ve_bash_script


All times are GMT -5. The time now is 08:27 PM.