05-08-2008
Split a record
UNIX Scripting
Hi I am trying to read a record and split it into multiple records
My Record looks like this
1001A0010@B0010*&^0)C0012hgdj&6sD0020fhfri93kivmepi9
where
UniqueID is 1001
segments are A,B,C,D
length of each segment is 4 characters after the segment 0010 for A
0010 for B 0012 for C etc
I have to split this file into
1001A0010@
B0010*&^0)
C0012hgdj&6s
D0020fhfri93kivmepi9
and Then I will be appending the Unique ID to the other segments like
1001A0010@
1001B0010*&^0)
1001C0012hgdj&6s
1001D0020fhfri93kivmepi9
Can anyone help me how to read a line and cut it and write it out
I wanna loop the line until end of line
Can anyone guide me how to do this
Thanks
Sreekanth
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
-Hi, I have a problem with parcing/spliting a file record into two parts and assigning the split parts to two viriables. The record is as follows:
ftrn facc ttrd feed xref fsdb fcp ruldb csdb omom fordr ftxn fodb fsdc texc oxox reng ttrn ttxn fqdb ... (5 Replies)
Discussion started by: aoussenko
5 Replies
2. Shell Programming and Scripting
Hi ,
I have a requirement to split the record based on particular match using UNIX.
Case1:
Input Record :
10.44.48.63;"Personals/Dating;sports";1441
Output Records :
10.44.48.63;Personals/Dating;1441;Original
10.44.48.63;sports;1441;Dummy
Case2:
Input Record : ... (5 Replies)
Discussion started by: mksuneel
5 Replies
3. Shell Programming and Scripting
I want to keep only records contain length is 10 other records should remove from my original file without redirecting to other output file.
Source
1234567890
123456789011234
abcdefghil
Expected Result
1234567890
abcdefghil (9 Replies)
Discussion started by: Jairaj
9 Replies
4. Shell Programming and Scripting
Hi,
My inputfile contains field separaer is ^.
12^inms^
13^fakdks^ssk^s3
23^avsd^
13^fakdks^ssk^a4
I wanted to print only 2 delimiter occurence i.e
12^inms^
23^avsd^ (4 Replies)
Discussion started by: Jairaj
4 Replies
5. UNIX for Dummies Questions & Answers
Hi ,
I have file with all records in one line, which needs to split it to have a fixed length.Am trying to execute the below script for the same
FILENAME="$1"
while line LINE
do
echo $LINE | awk 'BEGIN{n=1}{while(substr($0,n,10)){print substr($0,n,10);n+=10}}'
done < $FILENAME
it... (4 Replies)
Discussion started by: nishantrk
4 Replies
6. Shell Programming and Scripting
Hi,
Help required to split record value and write to new row.
Input
a~b~c~value in ('3','4','5')~test
output
a~b~c~3~test
a~b~c~4~test
a~b~c~5~test
input
a~b~c~value in ('3','4')~test
output
a~b~c~3~test
a~b~c~4~test (8 Replies)
Discussion started by: Jairaj
8 Replies
7. UNIX for Dummies Questions & Answers
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
8. Shell Programming and Scripting
Hi All,
Need help in writing a shell script for the below requirement:
i/p: 123456789
o/p:
123
456
789
Req: one record should be split into multiple based on the length ( after every third character it should be moved into next line)
Thanks in Advance (14 Replies)
Discussion started by: HemaV
14 Replies
9. Shell Programming and Scripting
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
10. UNIX for Advanced & Expert Users
Hi,
I have received a file which is 20 GB. We would like to split the file into 4 equal parts and process it to avoid memory issues.
If the record delimiter is unix new line, I could use split command either with option l or b.
The problem is that the line terminator is |##|
How to use... (5 Replies)
Discussion started by: Ravi.K
5 Replies
LEARN ABOUT POSIX
ddi_dma_nextseg
ddi_dma_nextseg(9F) Kernel Functions for Drivers ddi_dma_nextseg(9F)
NAME
ddi_dma_nextseg - get next DMA segment
SYNOPSIS
#include <sys/ddi.h>
#include <sys/sunddi.h>
int ddi_dma_nextseg(ddi_dma_win_t win, ddi_dma_seg_t seg, ddi_dma_seg_t *nseg);
INTERFACE LEVEL
This interface is obsolete. ddi_dma_nextcookie(9F) should be used instead.
PARAMETERS
win A DMA window.
seg The current DMA segment or NULL.
nseg A pointer to the next DMA segment to be filled in. If seg is NULL, a pointer to the first segment within the specified win-
dow is returned.
DESCRIPTION
ddi_dma_nextseg() gets the next DMA segment within the specified window win. If the current segment is NULL, the first DMA segment within
the window is returned.
A DMA segment is always required for a DMA window. A DMA segment is a contiguous portion of a DMA window (see ddi_dma_nextwin(9F)) which
is entirely addressable by the device for a data transfer operation.
An example where multiple DMA segments are allocated is where the system does not contain DVMA capabilities and the object may be non-con-
tiguous. In this example the object will be broken into smaller contiguous DMA segments. Another example is where the device has an upper
limit on its transfer size (for example an 8-bit address register) and has expressed this in the DMA limit structure (see
ddi_dma_lim_sparc(9S) or ddi_dma_lim_x86(9S)). In this example the object will be broken into smaller addressable DMA segments.
RETURN VALUES
ddi_dma_nextseg() returns:
DDI_SUCCESS Successfully filled in the next segment pointer.
DDI_DMA_DONE There is no next segment. The current segment is the final segment within the specified window.
DDI_DMA_STALE win does not refer to the currently active window.
CONTEXT
ddi_dma_nextseg() can be called from user or interrupt context.
EXAMPLES
For an example, see ddi_dma_segtocookie(9F).
ATTRIBUTES
See attributes(5) for a description of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Stability Level |Obsolete |
+-----------------------------+-----------------------------+
SEE ALSO
attributes(5), ddi_dma_addr_setup(9F), ddi_dma_buf_setup(9F), ddi_dma_nextcookie(9F), ddi_dma_nextwin(9F), ddi_dma_segtocookie(9F),
ddi_dma_sync(9F), ddi_dma_lim_sparc(9S), ddi_dma_lim_x86(9S), ddi_dma_req(9S)
Writing Device Drivers
SunOS 5.10 27 Sep 2002 ddi_dma_nextseg(9F)