Sponsored Content
Top Forums Shell Programming and Scripting Parsing record into multiple records in Shell Script Post 302371622 by summer_cherry on Sunday 15th of November 2009 11:49:28 PM
Old 11-16-2009
perl:

Code:
my $str="ADD|N000|8015662|DELETE|N001|9915662|MODIFY|N999|85678";
my @tmp = split(/[|](?=(?:DELETE)|(?:MODIFY))/,$str);
print join "\n", @tmp;

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Parsing out records from one huge record

Hi, I have one huge record and know that each record in the file is 550 bytes long. How do I parse out individual records from the single huge record. Thanks, (4 Replies)
Discussion started by: bwrynz1
4 Replies

2. UNIX for Advanced & Expert Users

Parsing records from one record

Hi, I got a file which is one huge record. I know each record should be 550 bytes long. How do I parse out the records from the one huge record. (1 Reply)
Discussion started by: bwrynz1
1 Replies

3. Shell Programming and Scripting

Script to display record spanning over multiple lines

Following are the lines from /etc/sudoers.conf bob SPARC = (OP) ALL : SGI = (OP) ALL fred ALL = (DB) NOPASSWD: ALL ALL CDROM = NOPASSWD: /sbin/umount /CDROM,\ /sbin/mount -o nosuid\,nodev /dev/cd0a /CDROM Could you please help me with shell/perl script to display the records with... (2 Replies)
Discussion started by: Ujan
2 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

Split a single record to multiple records & add folder name to each line

Hi Gurus, I need to cut single record in the file(asdf) to multile records based on the number of bytes..(44 characters). So every record will have 44 characters. All the records should be in the same file..to each of these lines I need to add the folder(<date>) name. I have a dir. in which... (20 Replies)
Discussion started by: ram2581
20 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

Splitting record into multiple records by appending values from an input field (AWK)

Hello, For the input file, I am trying to split those records which have multiple values seperated by '|' in the last input field, into multiple records and each record corresponds to the common input fields + one of the value from the last field. I was trying with an example on this forum... (4 Replies)
Discussion started by: imtiaz99
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

Shell script for insert multiple records into a Database

I have a table in an Informix DB into which I want to insert multiple records at a time. Data for one of the column should be unique & other column data may be the same for all the records I insert Typical Insert Statement I use to insert one row : insert into employee(empid, country, state)... (5 Replies)
Discussion started by: nisav
5 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
XmResolvePartOffsets(library call)										XmResolvePartOffsets(library call)

NAME
XmResolvePartOffsets -- A function that allows writing of upward-compatible applications and widgets SYNOPSIS
#include <Xm/Xm.h> void XmResolvePartOffsets( WidgetClass widget_class, XmOffsetPtr * offset); DESCRIPTION
The use of offset records requires one extra global variable per widget class. The variable consists of a pointer to an array of offsets into the widget record for each part of the widget structure. The XmResolvePartOffsets function allocates the offset records needed by an application to guarantee upward-compatible access to widget instance records by applications and widgets. These offset records are used by the widget to access all of the widget's variables. A widget needs to take the steps described in the following paragraphs. Instead of creating a resource list, the widget creates an offset resource list. To accomplish this, use the XmPartResource structure and the XmPartOffset macro. The XmPartResource data structure looks just like a resource list, but instead of having one integer for its off- set, it has two shorts. This structure is put into the class record as if it were a normal resource list. Instead of using XtOffset for the offset, the widget uses XmPartOffset. XmPartResource resources[] = { { BarNxyz, BarCXyz, XmRBoolean, sizeof(Boolean), XmPartOffset(Bar,xyz), XmRImmediate, (XtPointer)False } }; Instead of putting the widget size in the class record, the widget puts the widget part size in the same field. Instead of putting XtVersion in the class record, the widget puts XtVersionDontCheck in the class record. The widget defines a variable, of type XmOffsetPtr, to point to the offset record. This can be part of the widget's class record or a sep- arate global variable. In class initialization, the widget calls XmResolvePartOffsets, passing it a pointer to contain the address of the offset record and the class record. This does several things: o Adds the superclass (which, by definition, has already been initialized) size field to the part size field o Allocates an array based upon the number of superclasses o Fills in the offsets of all the widget parts with the appropriate values, determined by examining the size fields of all superclass records o Uses the part offset array to modify the offset entries in the resource list to be real offsets, in place The widget defines a constant that will be the index to its part structure in the offsets array. The value should be 1 greater than the index of the widget's superclass. Constants defined for all Xm widgets can be found in XmP.h. #define BarIndex (XmBulletinBIndex + 1) Instead of accessing fields directly, the widget must always go through the offset table. The XmField macro helps you access these fields. Because the XmPartOffset and XmField macros concatenate things together, you must ensure that there is no space after the part argument. For example, the following macros do not work because of the space after the part (Label) argument: XmField(w, offset, Label, text, char *) XmPartOffset(Label, text) Therefore, you must not have any spaces after the part (Label) argument, as illustrated here: XmField(w, offset, Label, text, char *) You can define macros for each field to make this easier. Assume an integer field xyz: #define BarXyz(w) (*(int *)(((char *) w) + offset[BarIndex] + XtOffset(BarPart,xyz))) The parameters for XmResolvePartOffsets are widget_class Specifies the widget class pointer for the created widget offset Returns the offset record RELATED INFORMATION
XmResolveAllPartOffsets(3). XmResolvePartOffsets(library call)
All times are GMT -4. The time now is 01:11 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy