How to grab a block of data in a file with repeating pattern?
I need to send email to receipient in each block of data in a file which has the sender address under TO and just send that block of data where it ends as COMPANY.
I tried to work this out by getting line numbers of the string HELLO but unable to grab the next block of data to send the next email. i used commands like
to get line numbers with email ids.
sed -n '/HELO/,/HELO/p' Sample2.txt this is where i am unable to get the corresponding block for that email id.
The sample file is
Last edited by Scott; 05-30-2013 at 02:05 PM..
Reason: Please use code tags
I want to search a file for a string and then if the string is found I need the line that the string is on - but also the previous two lines from the file (that the pattern will not be found in)
This is on solaris
Can you help? (2 Replies)
folks,
In my working directory, there a multiple large files which only contain one line in the file. The line is too long to use "grep", so any help?
For example, if I want to find if these files contain a string like "93849", what command I should use?
Also, there is oder_id number... (1 Reply)
I'm not a unix guy so excuses my ignorance... I'm the database ETL guy.
I'm trying to be proactive and devise a plan B for a ETL process where I expect a file 10X larger than what I process daily for a recast job. The ETL may handle it but I just don't know.
This file may need to be split... (3 Replies)
I want a shell script that will traverse a file system starting at specific path.
And look at all file names for repeating sequences of and remove them from the file name.
The portion of the name that gets removed has to be a repeating sequence of the same characters.
So the script would... (3 Replies)
I want to extract the last rows of a data file, similar to that one below:
C1 xxx
C2 rrr
C3 ttt
....
Cn-1 hhh
Cn bbb
C1 yyy
C2 sss
C3 uuu
...
Cn-1 iii
Cn ccc
...
I just want to extract the final rows between C1 and Cn at each data file. n is not a constant,... (2 Replies)
I tried searching the forums, but couldn't find anything relevant to my question.
I have an xml file like the following:
<topLevel numberBlock="BLOCK1">
<item="content1" title="Content 1">
<RefPath="path/to/file1.txt />
</item>
<item"content2" title="Content 2" >... (4 Replies)
I am a newbie and what I have is a captured file of content. I want to be able to grab 2 pieces of data, multiple times and print them to the screen.
DataFile
owner: locke
user: fun
data size: 60
location: Anaheim
owner: david
user: work
data size: 80
location: Orange
my script... (2 Replies)
in my file which is a rather long log file it contains many text and tables and there is one table with 15 columns and I am interested to read in the value in column6 and its corresponding value in column2. Trouble is I do not know how to script it as the line number various between different log... (8 Replies)
Sorry for the weird title but i have the following problem.
We have several files which have between 10000 and about 500000 lines in them. From these files we want to remove lines which contain a pattern which is located in another file (around 20000 lines, all EAN codes). We also want to get... (28 Replies)
im using the following code to grab data, but after the data in the range im specifying has been grabbed, i want to count how many instances of a particular pattern is found?
awk 'BEGIN{count=0} /parmlib.*RSP/,/seqfiles.*SSD/ {print; count++ } /103 error in ata file/ END { print count }'... (3 Replies)
Discussion started by: SkySmart
3 Replies
LEARN ABOUT OSX
copyb
copyb(9F) Kernel Functions for Drivers copyb(9F)NAME
copyb - copy a message block
SYNOPSIS
#include <sys/stream.h>
mblk_t *copyb(mblk_t *bp);
INTERFACE LEVEL
Architecture independent level 1 (DDI/DKI).
PARAMETERS
bp Pointer to the message block from which data is copied.
DESCRIPTION
copyb() allocates a new message block, and copies into it the data from the block that bp denotes. The new block will be at least as large
as the block being copied. copyb() uses the b_rptr and b_wptr members of bp to determine how many bytes to copy.
RETURN VALUES
If successful, copyb() returns a pointer to the newly allocated message block containing the copied data. Otherwise, it returns a NULL
pointer.
CONTEXT
copyb() can be called from user or interrupt context.
EXAMPLES
Example 1: : Using copyb
For each message in the list, test to see if the downstream queue is full with the canputnext(9F) function (line 21). If it is not full,
use copyb to copy a header message block, and dupmsg(9F) to duplicate the data to be retransmitted. If either operation fails, reschedule a
timeout at the next valid interval.
Update the new header block with the correct destination address (line 34), link the message to it (line 35), and send it downstream (line
36). At the end of the list, reschedule this routine.
1 struct retrans {
2 mblk_t *r_mp;
3 int r_address;
4 queue_t *r_outq;
5 struct retrans *r_next;
6 };
7
8 struct protoheader {
...
9 int h_address;
...
10 };
11
12 mblk_t *header;
13
14 void
15 retransmit(struct retrans *ret)
16 {
17 mblk_t *bp, *mp;
18 struct protoheader *php;
19
20 while (ret) {
21 if (!canputnext(ret->r_outq)) { /* no room */
22 ret = ret->r_next;
23 continue;
24 }
25 bp = copyb(header); /* copy header msg. block */
26 if (bp == NULL)
27 break;
28 mp = dupmsg(ret->r_mp); /* duplicate data */
29 if (mp == NULL) { /* if unsuccessful */
30 freeb(bp); /* free the block */
31 break;
32 }
33 php = (struct protoheader *)bp->b_rptr;
34 php->h_address = ret->r_address; /* new header */
35 bp->bp_cont = mp; /* link the message */
36 putnext(ret->r_outq, bp); /* send downstream */
37 ret = ret->r_next;
38 }
39 /* reschedule */
40 (void) timeout(retransmit, (caddr_t)ret, RETRANS_TIME);
41 }
SEE ALSO allocb(9F), canputnext(9F), dupmsg(9F)
Writing Device Drivers
STREAMS Programming Guide
SunOS 5.10 07 Nov 1996 copyb(9F)