Sponsored Content
Top Forums Shell Programming and Scripting Map values of blocks in a single line Post 302748715 by Ophiuchus on Wednesday 26th of December 2012 06:58:48 PM
Old 12-26-2012
Map values of blocks in a single line

Hello to all in forum,

Maybe some awk expert could help me.

I have this sample input:
Code:
<MGISP:IMSIS=99995626;
MT IMSI NUMBER SERIES ANALYSIS DATA
OPERATING TABLE
IMSIS            M                   NA  ANRES
99995626  6-77182                    4   OBA-200
                                         BO-200
                                         PLMN-0
                                         MAPVER-2
                                         INOPER-121
                                         NRRG-0
                                         CBA-58
                                         CBAZ-58

END
<MGISP:IMSIS=80321;
MT IMSI NUMBER SERIES ANALYSIS DATA
OPERATING TABLE
IMSIS            M                   NA  ANRES
80321            5-44531             4   OBA-60
                                         BO-35
                                         OWNMS
                                         NATMS
                                         ERIS-0
                                         PLMN-0
                                         STALL
                                         MAPVER-2
                                         INOPER-120
                                         NRRG-0
                                         CBA-15
                                         CBAZ-15
                                         CAMEL-3

END
<MGISP:IMSIS=29783;
MT IMSI NUMBER SERIES ANALYSIS DATA
OPERATING TABLE
IMSIS            M                   NA  ANRES
29783            5-38889             4   OBA-200
                                         BO-200
                                         PLMN-0
                                         MAPVER-2
                                         NRRG-0
                                         CBA-18
                                         CBAZ-18
                                         CAMEL-0

END
<MGISP:IMSIS=53002; 
MT IMSI NUMBER SERIES ANALYSIS DATA

OPERATING TABLE

UNIDENTIFIED NUMBER SERIES

END

And I'm would like to have the values of each IMSIS group mapped in a single line, so for the 3 IMSIS blocks
above, the output would be 3 lines as follow (the headers are fixed and could go in that order):

Code:
IMSIS,M,NA,OBA,BO,PLMN,MAPVER,NRRG,CBA,CBAZ,CAMEL,INOPER,OWNMS,NATMS,ERIS,STALL                     
99995626,6-77182,4,200,200,0,2,0,58,58,,121,,,,
80321,5-44531,4,60,35,0,2,0,15,15,3,120,1,1,0,1
29783,5-38889,4,200,200,0,2,0,18,18,0,,,,,
53002,UNIDENTIFIED

Note:
The parameters OWNMS, NATMS and STALL don't have a number related, so in the output could be written a "1", to show that
they appear in the input (I've highlighted those 1's in red for reference).

If in the input some IMSIS is not defined (Print shows UNIDENTIFIED), then in the output would show UNIDENTIFIED.

Thanks in advance for any help.

Last edited by Ophiuchus; 12-26-2012 at 08:05 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Find 5 lines and replace with 18 line in sql file where it contains multiple blocks.

My sql file xyz_abc.sql in this file there are multiple sql block in this block I need to find the following block rem Subset Rows (&&tempName.*) CREATE VIEW &&tempName.* AS SELECT * FROM &&tempName.* WHERE f is not null and replace with following code rem Subset Rows... (9 Replies)
Discussion started by: Zaheer.mic
9 Replies

2. Shell Programming and Scripting

how to split this file into blocks and then send these blocks as input to the tool called Yices?

Hello, I have a file like this: FILE.TXT: (define argc :: int) (assert ( > argc 1)) (assert ( = argc 1)) <check> # (define c :: float) (assert ( > c 0)) (assert ( = c 0)) <check> # now, i want to separate each block('#' is the delimeter), make them separate files, and then send them as... (5 Replies)
Discussion started by: paramad
5 Replies

3. Shell Programming and Scripting

How to map the values of an array in perl?

Hi, I have 2 arrays: @names=qw(amith veena chaitra); @files=qw(file.txt file1.txt file3.txt); There is one to one relationship between names and files. There needs to be mapping created between names and files. The output should be like this: amith --> file.txt veena --->... (3 Replies)
Discussion started by: vanitham
3 Replies

4. Shell Programming and Scripting

Multiple lines in a single column to be merged as a single line for a record

Hi, I have a requirement with, No~Dt~Notes 1~2011/08/1~"aaa bbb ccc ddd eee fff ggg hhh" Single column alone got splitted into multiple lines. I require the output as No~Dt~Notes 1~2011/08/1~"aaa<>bbb<>ccc<>ddd<>eee<>fff<>ggg<>hhh" mean to say those new lines to be... (1 Reply)
Discussion started by: Bhuvaneswari
1 Replies

5. Shell Programming and Scripting

Show distinct values of a key from a single line

Hi All, I am newbie to linux. Can somebody help me with following requirement. I have one huge line. I have to find out particular key/value pair to see the distinct value of that key. Portion of the String:- <?xml version="1.1" encoding="UTF-8"?> <Data><Val Ti="1342750845538" Du="0"... (5 Replies)
Discussion started by: kmajumder
5 Replies

6. Shell Programming and Scripting

Row blocks to column blocks

Hello, Searched for a while and found some "line-to-column" script. My case is similar but with multiple fields each row: S02 Length Per S02 7043 3.864 S02 54477 29.89 S02 104841 57.52 S03 Length Per S03 1150 0.835 S03 1321 0.96 S03 ... (9 Replies)
Discussion started by: yifangt
9 Replies

7. Shell Programming and Scripting

sed multiple multi line blocks of text containing pattern

Hi, I have a log file which has sessionids in it, each block in the log starts with a date entry, a block may be a single line or multiple lines. I need to sed (or awk) out the lines/blocks with that start with a date and include the session id. The files are large at several Gb. My... (3 Replies)
Discussion started by: andyatit
3 Replies

8. Shell Programming and Scripting

sed - filter blocks between single delimiters matching a pattern

Hi! I have a file with the following format:CDR ... MSISDN=111 ... CDR ... MSISDN=xxx ... CDR ... MSISDN=xxx ... CDR ... MSISDN=111 (2 Replies)
Discussion started by: Flavius
2 Replies

9. Shell Programming and Scripting

Bring values in the second column into single line (comma sep) for uniq value in the first column

I want to bring values in the second column into single line for uniq value in the first column. My input jvm01, Web 2.0 Feature Pack Library jvm01, IBM WebSphere JAX-RS jvm01, Custom01 Shared Library jvm02, Web 2.0 Feature Pack Library jvm02, IBM WebSphere JAX-RS jvm03, Web 2.0 Feature... (10 Replies)
Discussion started by: kchinnam
10 Replies

10. Solaris

Can I run repair on lot of blocks with single command ?

Hi, I have Solaris-10 OS on T5220. Both local disks were mirrored under SVM. Somehow when one disk gone bad (c0t1d0), other disk (c0t0d0) also got lot of bad block. We have readable data only on c0t0d0, but as soon as server comes after, it hangs when I run few commands because of read errors,... (1 Reply)
Discussion started by: solaris_1977
1 Replies
ALCC(1) 							  aMule utilities							   ALCC(1)

NAME
alcc - text based eD2k links calculator for aMule SYNOPSIS
alcc [-p] [-v] <inputfiles_list> alcc [-h] DESCRIPTION
Compute the eD2k links of all the input files given in the <inputfiles_list> (There can be one or more files). [ -p, --parthashes ] Compute and add part hashes to the computed eD2k links. [ -h, --help ] Prints a short usage description. [ -v, --verbose ] Be verbose - show also calculation steps. REPORTING BUGS
Please report bugs either on our forum (http://forum.amule.org/), or in our bugtracker (http://bugs.amule.org/). Please do not report bugs in e-mail, neither to our mailing list nor directly to any team member. COPYRIGHT
aMule and all of its related utilities are distributed under the GNU General Public License. SEE ALSO
alc(1), amuled(1), amulecmd(1), amuleweb(1), cas(1), ed2k(1), wxcas(1), xas(1) AUTHOR
This manpage was written by Vollstrecker <amule@vollstreckernet.de> aMule eD2k links calculator November 2011 ALCC(1)
All times are GMT -4. The time now is 07:10 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy