...
Input file is
...
If I would like get the output file in below :
Expected output should be arranged in data1 to data3 in every row. If any column is loss, the data will show in N,N.
I don't know that how to solve this problem, please suggest me.
...
I don't quite understand your implementation in Python, but I do understand your problem. A suggested algorithm is as follows:
I've implemented this algorithm in Perl, and it is posted below.
A few notes:
(1) A hash value is expected to be a scalar in Perl, so you set the "reference" to an array as the hash value. A "reference" in Perl is similar to a "pointer" in C. No clue what it is called in Python, or if you are using that in your code.
(2) Perl has 0-based arrays i.e. the first index of an array is 0. (It appears that Python array indexes start with 1, by looking at your code.) So, once you read the second token, say, "data3", and extract 3 from it, then you'll have to update index 5 (=2*3 - 1) of the template array.
(3) I've adopted this "hard-coded" template array approach because I see this in your code:
Quote:
Originally Posted by awil
which makes me believe that a particular token "SN1", or "AC2" or "TP3" can have at the most three records. If that's not the case, then the problem becomes more interesting!
By this approach, once you are done reading the file, your data structure is ready and you can simply print off the results. I hope the script comments are sufficient.
tyler_durden
This User Gave Thanks to durden_tyler For This Post:
I have one script which generate file called report.txt having following output
parameter_name status comment
banking ok NA
finance 30% hike NA
Loan_department ok 20%
HR_Group defaulters Ajay
I wanted to convert this file into tabular form.
You can see each line contain 3 words and... (7 Replies)
Hello All,
I have following data into my file named record.
Name City phone number email
Jhon Newyork 123456987 jhon@gmail.com
Maria Texas 569865612 Maria_Sweet@rediffmail.com
Chan Durben NA Chan123@gmail.com
The output should be in straight columns.. There should not be any... (1 Reply)
Hello All,
I have following data into my file named record.
Name City phone number email
Jhon Newyork 123456987 jhon@gmail.com
Maria Texas 569865612 Maria_Sweet@rediffmail.com
Chan Durben NA Chan123@gmail.com
|---------------------------------------------------------------|
|Name ... (2 Replies)
Hi Team,
I have one file in that almost 100+ words in lines
Eg:-
Unix
windows
solaris
Linux
...
...
But I want arrange all lines in table format and can able read on screen
Eg: -
Unix windows solaris Lunix......
Hp unix Mac-os ......
Like as Table...... (11 Replies)
Hi All,
I am new to forum, I am looking to arrange a file in specific format but unable to get the formula to do it, already googled for the same, but didnt find the answer :(. hope to get help here :o:o:o:o:o
I have to files :
$ cat Dev_List2
0685
0686
0687
0688
0689
068A
068B
068C... (2 Replies)
My Code
Hi Friends,
I need to get output in table format using unix shell script.For example my server CPU and memory utilization report will come as a mail with ordinary format but i want to make as table format.
Here two output finally we are getting:-
CPU utilization is... (2 Replies)
Input
217:fngadi4osa:fngadi4osa:M 217:415744:N/A
227:fngadi4osa:fngadi4osa: M 227:51200:N/A
228:fngadi4osa:fngadi4osa: M 228:102400:N/A
65:sapgt04:sapgt04: M 65:104448:N/A
228:fngadi4osa:fngadi4oma: M 228:102400:N/A
Output
217:fngadi4osa:fngadi4osa:M 217:415744:N/A... (3 Replies)
Hello,
Could you please let me know the correct format of CREATE TABLE statement with DATE format.
CREATE TABLE EMP_TABLE1 (
NAME VARCHAR(6) PRIMARY KEY,
ADDRESS VARCHAR(6),
BIRTH_DATE DATE
);
I want BIRTH_DATE to be in "YYYYMMDDHHMISS" format.
How we can create table with... (4 Replies)
Everybody,
can you tell me how express about this; we have text data file as :
parameter1 Parameter2
AA 55
BB 77
. .
. .
. .
We want to draw table for this data as attached then send as body of Email (4 Replies)
Data on my input file :
Ac1n1s1c2n2s2XPd1r1e1t1d2r2e2t2d3r3e3t3d4r4e4t4RT
Bh1k1p1h2k2p2NTq1y1f1m1q2y2f2m2q3y3f3m3q4y4f4m4ZN
and i want the output to be:
Ac1n1s1XPd1r1e1t1RT
Ac1n1s1XPd2r2e2t2RT
Ac1n1s1XPd3r3e3t3RT
Ac1n1s1XPd4r4e4t4RT
Ac2n2s2XPd1r1e1t1RT
Ac2n2s2XPd2r2e2t2RT... (6 Replies)