I have a case where, I need to look into a file.
Go to each line of the file, find the length of the line, if the length of the line is more than 75 chars, I need to split the line into multiple lines of 75chars max. If the length of the line is less than 75, we need not do anything.
So at the... (4 Replies)
Hi,
I've some files with the following data and i need to convert the lines between the separator ---, into a single line. I've tried with the paste cmd but my main problem is that the number of lines between the separator is not fix, it can very between 1-4 lines.
Input
---
2010-02-22... (4 Replies)
This is related to one of my previous post but now with a slight difference: I need the "Updated:" to be in one line as well as the "Information:" on one line as well. These are in multiple lines right now as seen below. These can have 2 or more lines that needs to be in one line.
System name:... (8 Replies)
Hi,
I have a requirement with,
No~Dt~Notes
1~2011/08/1~"aaa
bbb
ccc
ddd
eee
fff
ggg
hhh"
Single column alone got splitted into multiple lines.
I require the output as
No~Dt~Notes
1~2011/08/1~"aaa<>bbb<>ccc<>ddd<>eee<>fff<>ggg<>hhh"
mean to say those new lines to be... (1 Reply)
This is related to one of my previous post.. I have huge file currently I am using loop to read file and checking each line to build this single record, its taking much much time to parse those records.. I thought there should be a way to do this in awk or sed.
I found this code in this forum... (7 Replies)
Hi all,
I have a requirement to covert multiple lines in a comma delimited file to a single line through shell scripting. We should compare the data in the first column in each line. If it is same, then the other data should be put in the same line.Below is the sample input and expected output:... (4 Replies)
I Want to merge multiple lines based on the 1st field and keep into single record.
SRC File:
AAA_POC_DB.TAB1
AAA_POC_DB.TAB2
AAA_POC_DB.TAB3
AAA_POC_DB.TAB4
BBB_POC_DB.TAB1
BBB_POC_DB.TAB2
CCC_POC_DB.TAB6
OUTPUT
-----------------
'AAA_POC_DB','TAB1','TAB2','TAB3','TAB4'... (10 Replies)
I have code as below
# create temporary table `temp4277`(key(waybill_no))
select waybill_no,concat_ws('',card_type,card_series_no) cardinfo
from rfid_temp_ticket where waybill_no='4277'
group by... (4 Replies)
Discussion started by: kaushik02018
4 Replies
LEARN ABOUT DEBIAN
dispatch_apply
dispatch_apply(3) BSD Library Functions Manual dispatch_apply(3)NAME
dispatch_apply -- schedule blocks for iterative execution
SYNOPSIS
#include <dispatch/dispatch.h>
void
dispatch_apply(size_t iterations, dispatch_queue_t queue, void (^block)(size_t));
void
dispatch_apply_f(size_t iterations, dispatch_queue_t queue, void *context, void (*function)(void *, size_t));
DESCRIPTION
The dispatch_apply() function provides data-level concurrency through a "for (;;)" loop like primitive:
dispatch_queue_t the_queue = dispatch_get_concurrent_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT);
size_t iterations = 10;
// 'idx' is zero indexed, just like:
// for (idx = 0; idx < iterations; idx++)
dispatch_apply(iterations, the_queue, ^(size_t idx) {
printf("%zu
", idx);
});
Like a "for (;;)" loop, the dispatch_apply() function is synchronous. If asynchronous behavior is desired, please wrap the call to
dispatch_apply() with a call to dispatch_async() against another queue.
Sometimes, when the block passed to dispatch_apply() is simple, the use of striding can tune performance. Calculating the optimal stride is
best left to experimentation. Start with a stride of one and work upwards until the desired performance is achieved (perhaps using a power
of two search):
#define STRIDE 3
dispatch_apply(count / STRIDE, queue, ^(size_t idx) {
size_t j = idx * STRIDE;
size_t j_stop = j + STRIDE;
do {
printf("%zu
", j++);
} while (j < j_stop);
});
size_t i;
for (i = count - (count % STRIDE); i < count; i++) {
printf("%zu
", i);
}
FUNDAMENTALS
Conceptually, dispatch_apply() is a convenient wrapper around dispatch_async() and a semaphore to wait for completion. In practice, the dis-
patch library optimizes this function.
The dispatch_apply() function is a wrapper around dispatch_apply_f().
SEE ALSO dispatch(3), dispatch_async(3), dispatch_queue_create(3), dispatch_semaphore_create(3)Darwin May 1, 2009 Darwin