Sponsored Content
Top Forums Shell Programming and Scripting Split a single record to multiple records & add folder name to each line Post 302536469 by ram2581 on Tuesday 5th of July 2011 01:01:52 PM
Old 07-05-2011
File is /abc/20010125/def/asdf.dat
The file is
Input file data:
Code:
OA        200909C+0000000.5600000091.0000 OA        200909  P+0000000.5600000090.0000 PA        200909  C+0000000.5800000091.0000

Output file name : /abc/20010125/def/asdf_split
Output file data
Code:
OA        200909C+0000000.5600000091.0000 20010125
OA        200909P+0000000.5600000090.0000 20010125
PA        200909C+0000000.5800000091.0000 20010125

please let me know

Last edited by Franklin52; 07-06-2011 at 04:03 AM.. Reason: Please use code tags for code and data samples, thank you
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Sort & Split records in a file

Hi, I am new to scripting. I need a script to sort and the records in a file and then split them into different files. For example, the file is: H1...................... H2...................... D2.................... D2.................... H1........................... (15 Replies)
Discussion started by: Sunitha_edi82
15 Replies

2. Shell Programming and Scripting

Parsing record into multiple records in Shell Script

Hi, I am trying to parse a very long record in a text file into multiple records by checking ADD, DELETE, or MODIFY field value in a shell script. Input # File name xyz.txt ADD|N000|8015662|DELETE|N001|9915662|MODIFY|N999|85678 Output ADD|N000|8015662| DELETE|N001|9915662|... (8 Replies)
Discussion started by: naveed
8 Replies

3. Shell Programming and Scripting

Single/Multiple Line with Special characters - Find & Replace in Unix Script

Hi, I am creating a script to do a find and replace single/multiple lines in a file with any number of lines. I have written a logic in a script that reads a reference file say "findrep" and populates two variables $FIND and $REPLACE print $FIND gives Hi How r $u Rahul() Note:... (0 Replies)
Discussion started by: r_sarnayak
0 Replies

4. Shell Programming and Scripting

Multiple records based on ';' in the record

Hi All, I have a *.csv files in a die /pro/lif/dow, (pipe delimiter file), these files are having 8 columns and 6 column(CDR_LOGIC) records are populated as below, I need to incorporate the below logic in all the *.csv files. 11||:ColumnA||:ColumnB 123||:ColumnA IIF(:ColumnA = :ColumnC then... (6 Replies)
Discussion started by: shruthidwh
6 Replies

5. 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

6. UNIX for Dummies Questions & Answers

Split single record to multiple records

Hi Friends, source .... col1,col2,col3 a,b,1;2;3 here colom delimeter is comma(,). here we dont know what is the max length of col3 means now we have 1;2;3 next time i will receive 1;2;3;4;5;etc... required output .............. col1,col2,col3 a,b,1 a,b,2 a,b,3 please give me... (5 Replies)
Discussion started by: bab.galary
5 Replies

7. Shell Programming and Scripting

Split records into multiple records

Hi All, I am trying to split a record into multiple records based on a value. Input.txt "A",1,0,10 "B",2,0,10,15,20 "C",3,11,14,16,19,21,23 "D",1,0,5 My desired output is: "A",1,0,10 "B",2,0,10 "B",2,15,20 "C",3,11,14 "C",3,16,19 "C",3,21,23 (4 Replies)
Discussion started by: kmsekhar
4 Replies

8. Shell Programming and Scripting

Multiple Records from 1 Record

I need to make one record to multiple records based on occurence column in the record and change the date.For example below first record has 5 ,so need to create 5 records from one and change the date to 5 months.Occurence can be any number. I am unable to come with a script.Can some one help ... (5 Replies)
Discussion started by: traininfa
5 Replies

9. Shell Programming and Scripting

Split a large file in n records and skip a particular record

Hello All, I have a large file, more than 50,000 lines, and I want to split it in even 5000 records. Which I can do using sed '1d;$d;' <filename> | awk 'NR%5000==1{x="F"++i;}{print > x}'Now I need to add one more condition that is not to break the file at 5000th record if the 5000th record... (20 Replies)
Discussion started by: ibmtech
20 Replies

10. Shell Programming and Scripting

How to split one record to multiple records?

Hi, I have one tab delimited file which is having multiple store_ids in first column seprated by pipe.I want to split the file on the basis of store_id(separating 1st record in to 2 records ). I tried some more options like below with using split,awk etc ,But not able to get proper output. can... (1 Reply)
Discussion started by: jaggy
1 Replies
PMUNPACKEVENTRECORDS(3) 				     Library Functions Manual					   PMUNPACKEVENTRECORDS(3)

NAME
pmUnpackEventRecords - unpack event records C SYNOPSIS
#include <pcp/pmapi.h> int pmUnpackEventRecords(pmValueSet *vsp, int idx, pmResult ***rap); cc ... -lpcp DESCRIPTION
Event records are encoded as a packed array of records within a pmResult using a container metric with a value of type PM_TYPE_EVENT. pmUnpackEventRecords may be used to unpack event records from a metric value identified by vsp and idx. If the metric has a singular value, idx should be 0, else the ordinal instance value identified by idx will be unpacked, i.e. vsp->vlist[idx]. The unpacked records are turned into pmResult structures, one per event record and one metric per event parameter, and rap is returned as a pointer to an array (NULL pointer terminated) of pointers to the pmResult structures. Some control information from the packed event records is unpacked into additional ``anonymous'' metrics as follows: 1. If the event record has a non-zero flags value, then the corresponding pmResult will have the flags value encoded with the additional metric event.flags that is inserted ahead of all other event parameters. 2. If the event record flag is set to PM_EVENT_FLAG_MISSED, then the corresponding pmResult will have one metric event.missed with a value that equals the number of event records ``missed'' because either the PMDA could not keep up, or the PMAPI client did not collect the event records fast enough. pmUnpackEventRecords returns the number of pmResult structures as the return value, which is >= 0 for success. rset and the associated pmResult structures may be freed using the convenience function pmFreeEventResult(3). RETURN VALUE
The following errors are possible: PM_ERR_CONV The values associated with vsp are not encoded using the format PM_VAL_DPTR or PM_VAL_SPTR, or the flags at the head of the event record has an unexpected value. PM_ERR_INST The value associated with vsp is not singular as expected. PM_ERR_TYPE vsp is not a value of type PM_TYPE_EVENT. PM_ERR_TOOSMALL The value identified by vbp is not legal because the value length is less than the minimum size, or the number of event records encoded in the (value header) pmEventArray structure is negative, or the number of missed event records in the pmEventArray array is negative. PM_ERR_TOOBIG Either vsp indicates more than one value is present (all the event records are expected to be packed in a single metric value), or when unpacking the event records, the processing continues past the end of the enclosing value. Indicates corruption of the packed event record. PM_ERR_TYPE Event parameters must have one of the arithmetic types, else PM_TYPE_AGGREGATE, PM_TYPE_STRING or PM_TYPE_AGGREGATE_STATIC. other values < 0 refer to pmErrStr(3). SEE ALSO
PMAPI(3) and pmFreeEventResult(3). Performance Co-Pilot PCP PMUNPACKEVENTRECORDS(3)
All times are GMT -4. The time now is 07:12 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy