Sponsored Content
Top Forums Shell Programming and Scripting How to grab a block of data in a file with repeating pattern? Post 302817255 by DGPickett on Wednesday 5th of June 2013 01:18:47 PM
Old 06-05-2013
PS: Looks like it ends in ^\.$ like smtp/esmtp data, not COMPANY.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Search file for pattern and grab some lines before pattern

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)
Discussion started by: frustrated1
2 Replies

2. UNIX for Dummies Questions & Answers

search and grab data from a huge file

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)
Discussion started by: ting123
1 Replies

3. Shell Programming and Scripting

Can I split a 10GB file into 1 GB sizes using my repeating data pattern

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)
Discussion started by: john091
3 Replies

4. Shell Programming and Scripting

Remove repeating pattern from beginning of file names.

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)
Discussion started by: z399y
3 Replies

5. UNIX for Dummies Questions & Answers

Extract repeating data from file

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)
Discussion started by: natasha
2 Replies

6. Shell Programming and Scripting

How to grab data from xml block?

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)
Discussion started by: jl487
4 Replies

7. Shell Programming and Scripting

Grab 2 pieces of data within a file

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)
Discussion started by: greglocke
2 Replies

8. Shell Programming and Scripting

Grab data within a table in a long log file.

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)
Discussion started by: piynik
8 Replies

9. Shell Programming and Scripting

awk remove/grab lines from file with pattern from other file

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)
Discussion started by: SDohmen
28 Replies

10. Shell Programming and Scripting

awk to grab data in range then search for pattern

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
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)
All times are GMT -4. The time now is 01:29 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy