Sponsored Content
Top Forums Shell Programming and Scripting Map values of blocks in a single line Post 302749161 by Ophiuchus on Thursday 27th of December 2012 04:21:27 PM
Old 12-27-2012
Hello bipinajith, thank you for your help!

It works fine, just one issue. If a particular series has more than one block that begins with the same numbers, the print is like below:
In this example, the series 942 has 3 blocks of IMSIs related, so the print only for this command MGISP:IMSIS=942 is:
Code:
<MGISP:IMSIS=942;
MT IMSI NUMBER SERIES ANALYSIS DATA
OPERATING TABLE
IMSIS            M                   NA  ANRES
942111           6-33313             4   OBA-150
                                         BO-49
                                         PLMN-0
                                         MAPVER-2
                                         NRRG-0
                                         CBA-22
                                         CBAZ-22
                                         CAMEL-3
 
942123           6-889134            4   OBA-150
                                         BO-49
                                         PLMN-0
                                         MAPVER-2
                                         NRRG-0
                                         CBA-22
                                         CBAZ-22
 
94201            5-777714            4   OBA-150
                                         BO-49
                                         PLMN-0
                                         MAPVER-2
                                         NRRG-0
                                         CBA-50
                                         CBAZ-50
                                         CAMEL-0
 
END

And the output should be:
Code:
IMSIS,M,NA,OBA,BO,PLMN,MAPVER,NRRG,CBA,CBAZ,CAMEL,INOPER,OWNMS,NATMS,ERIS,STALL
942111,6-33313,4,150,49,0,2,0,22,22,3,,,,,
942123,6-889134,4,150,49,0,2,0,22,22,,,,,,
94201,5-777714,4,150,49,0,2,0,50,50,0,,,,,

But now is only printing the first line and with 942 only as below:
Code:
IMSIS,M,NA,OBA,BO,PLMN,MAPVER,NRRG,CBA,CBAZ,CAMEL,INOPER,OWNMS,NATMS,ERIS,STALL
942,6-33313,4,150,49,0,2,0,22,22,3,,,,,

I think the first 4 fields could be get from lines in red.

May you help me to fix this part.
Thanks in advance.
 

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
SRAW(8) 						      System Manager's Manual							   SRAW(8)

NAME
sraw - benchmark raw scsi I/O performance under linux SYNOPSIS
sraw [ -fiv6 ] scsi-device [ bstart [ bstep ] ] DESCRIPTION
This program basically reads the specified scsi device and measures the throughput. Note that the filesystem *AND* the buffer cache are bypassed by this code, this program was designed to benchmark the naked scsi drivers by themselves without the need to account for the overhead of any other portion of the kernel. It also could be used to benchmark disk read throughput. This program does a series of reads of the disk, of consecutive areas on the disk. The device is first queried to determine the sector size for the device, and then the series of reads is begun. About 5.0 Mb is read from the device, and then the performance numbers are reported. Note that since the buffer cache is completely bypassed, there is no need to be concerned about cache hits or anything. Output of sraw is a set of lines, 4 numbers per line: blocksize, elapsed time, nblocks and throughput (in bytes per second). scsi-device is either a block device (e.g. /dev/sda, /dev/scd0) or a generic SCSI device (e.g. /dev/sg0). OPTIONS
-f set FUA (Force Unit Access) bit during read. Data is then read from media instead of internal drive cache. -i use legacy ioctl instead of new SG I/O layer (will not work on 2.6 kernel and block devices). -v more verbose output. -6 use 6-bytes instead of 10-bytes read command. In this case, only the first GB of data could be read from media. bstart starting block to check different zones on ZBR discs bstep factor for sequential stepping, default 1. Use 0 for reading always the same blocks (from cache) ERRORS
sraw could issue input/output errors when reading too many blocks at the same time from a block device like /dev/sda. To get rid of them, use /dev/sgN instead. AUTHOR
sraw was first written by Eric Youngdale. Extensions (-v, -f, -6, SG IO, man page) were written by Eric Delaunay. SEE ALSO
sg_dd(8) from sg3-utils package. AVAILABILITY
sraw is available at ftp://tsx-11.mit.edu/pub/linux/ALPHA/scsi/ Nov 1993 SRAW(8)
All times are GMT -4. The time now is 03:33 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy