Concatenate text between patterns in individual strings
In any given file, wherever a certain data block exists I need to concatenate the values(text after each "=" sign) from that block. in that block. The block starts and ends with specific pattern, say BEGIN DS and END DS respectively. The block size may vary. A file will have multiple such blocks. So say if there are 6 such blocks then I need 6 strings which have data in those respective blocks. Kindly guide.
Eg. "$file" has content : OUTPUT :::
I know how to use sed for this if the block size was fixed ...
Last edited by Scrutinizer; 06-01-2012 at 04:53 AM..
Reason: code tags instead of quote tags
I have a small requirement
How to get patterns between string this way
Input..
05 ABC.
TAGTAG 10 AAA PIC 9
10 BBB PIC X
COMMET 10 CCC COMP PIC 9
05 DEF
I wanted to get all the variable between 05 ABC and next 05 level
out put should be
AAA
BBB (6 Replies)
Hi Friends,
I have a requirement
I need to concatenate the below two strings.
String 1 = /@jobid_at_
String 2 = value stored in ORACLE_SID
String 3 = string1 concatenated with String 2.
Please let me know how should i do it in UNIX.
Thanks, (2 Replies)
if i use
echo "ravi"
echo "sankar"
it showing output
ravi
sankar
but i want output as ravi sankar
remember sankar should be in another echo statement only (2 Replies)
Hello!
Can anyone explain line 28 for me? I was thinking *a would be replaced by *b, but it actually appends *a to *b. I know it is related to pointer address, but could not figure it out by myself. Thanks a lot!
1 //Concatenate two strings
2
3 #include<stdio.h>
4 char *stradd (char *,... (5 Replies)
Hi,I'm trying to concatenate @example.com to each line of a file f1.txt. and push it into f2.txt. Here is the code i'm using.
for i in `cat /home/linux1/xxxxxxx/f1.txt`;
do
echo ${i}@example.com > /home/linux1/xxxxxx/f2.txt;
done
But above code only printing @example.com in f2.txt. what... (18 Replies)
hi guys, I have this question. I am creating an script to that read a text file(.ini) with the list of the patterns to find for example:
EPMS_VO
EMPS_PARTS
Then it check if file have been delivered in a folder and process it with each pattern, but I am having problems concatenting the... (7 Replies)
Discussion started by: Danman
7 Replies
LEARN ABOUT FREEBSD
pullupmsg
pullupmsg(9F) Kernel Functions for Drivers pullupmsg(9F)NAME
pullupmsg - concatenate bytes in a message
SYNOPSIS
#include <sys/stream.h>
int pullupmsg(mblk_t *mp, ssize_t len);
INTERFACE LEVEL
Architecture independent level 1 (DDI/DKI).
PARAMETERS
mp Pointer to the message whose blocks are to be concatenated. mblk_t is an instance of the msgb(9S) structure.
len Number of bytes to concatenate.
DESCRIPTION
pullupmsg() tries to combine multiple data blocks into a single block. pullupmsg() concatenates and aligns the first len data bytes of the
message pointed to by mp. If len equals -1, all data are concatenated. If len bytes of the same message type cannot be found,
pullupmsg() fails and returns 0.
RETURN VALUES
On success, 1 is returned; on failure, 0 is returned.
CONTEXT
pullupmsg() can be called from user or interrupt context.
EXAMPLES
Example 1: Using pullupmsg()
This is a driver write srv(9E) (service) routine for a device that does not support scatter/gather DMA. For all M_DATA messages, the data
will be transferred to the device with DMA. First, try to pull up the message into one message block with the pullupmsg() function (line
12). If successful, the transfer can be accomplished in one DMA job.
Otherwise, it must be done one message block at a time (lines 19-22). After the data has been transferred to the device, free the message
and continue processing messages on the queue.
1 xxxwsrv(q)
2 queue_t *q;
3 {
4 mblk_t *mp;
5 mblk_t *tmp;
6 caddr_t dma_addr;
7 ssize_t dma_len;
8
9 while ((mp = getq(q)) != NULL) {
10 switch (mp->b_datap->db_type) {
11 case M_DATA:
12 if (pullupmsg(mp, -1)) {
13 dma_addr = vtop(mp->b_rptr);
14 dma_len = mp->b_wptr - mp->b_rptr;
15 xxx_do_dma(dma_addr, dma_len);
16 freemsg(mp);
17 break;
18 }
19 for (tmp = mp; tmp; tmp = tmp->b_cont) {
20 dma_addr = vtop(tmp->b_rptr);
21 dma_len = tmp->b_wptr - tmp->b_rptr;
22 xxx_do_dma(dma_addr, dma_len);
23 }
24 freemsg(mp);
25 break;
. . .
26 }
27 }
28 }
SEE ALSO srv(9E), allocb(9F), msgpullup(9F), msgb(9S)
Writing Device Drivers
STREAMS Programming Guide
NOTES
pullupmsg() is not included in the DKI and will be removed from the system in a future release. Device driver writers are strongly encour-
aged to use msgpullup(9F) instead of pullupmsg().
SunOS 5.10 11 Nov 1996 pullupmsg(9F)