If "in front of" means "following" (as stated in the thread title):
Looking for 99 left from a ~ and summing up the value right from the ~
At the end printing the sum.
This User Gave Thanks to MadeInGermany For This Post:
Hi
I am trying to add count values from two different files into one file. Could any body please suggest me best command to do this? My problem was as follows:
a.txt b.txt c.txt
10 20 30(needed)
i tried cat a.txt b.txt > c.txt (its not adding the values)
Thanks in advance..
Praveen (8 Replies)
Hi.
Im looking for way to sum numbers from top. For example i have such command
top -b -n | grep Cpu | cut -c 35 - 39
which give me output 97.0 . Ho can i do with that value any arithmetic actions (for example 97.0 +1)?
Using
c = $((top -b -n | grep Cpu | cut -c 35 - 39))
gives me... (8 Replies)
Hi All,
I have a file which is having 3 columns as (string string integer)
a b 1
x y 2
p k 5
y y 4
.....
.....
Question:
I want get the unique value of column 2 in a sorted way(on column 2) and the sum of the 3rd column of the corresponding rows. e.g the above file should return the... (6 Replies)
I am running the following script :
cat ind_sls_extr_UX.out_sorted | while read each_rec
do
count=`echo "${each_rec}" | cut -c1-2`
if
then
final_amount=0
amount=`echo "${each_rec}" | cut -c280-287`
echo "${amount}"
final_amount=`expr ${amount} + ${amount}`
... (7 Replies)
I have a file in the following layout:
201008005946873001846130058030701006131840000000000000000000
201008006784994001154259058033001009527844000000000000000000
201008007323067002418095058034801002418095000000000000000000
201008007697126001722141058029101002214158000000000000000000... (2 Replies)
Hi
I have redc containing the values 3, 6, 2, 8, and 1.
I have work containing the values 8, 2, 11, 7, and 9.
Is there a way to find the sum of redc and work?
I need to compare the sum of those two arrays to something else, so is it okay to put that into my END?
TY! (4 Replies)
Hi,
I would like to be able to sum up the counts of a column by the ID of another column. Example (although the actual file I have has thousands of IDs):
Input file:
A1BG-AS1:001 3
A1BG-AS1:002 0
A1BG-AS1:003 2
A1CF:001 1038
A1CF:002 105
A1CF:003 115
A1CF:004 137
Desired output... (3 Replies)
Hi there,
I have 2 files in following format
cat file_1
Storage Group Name: aaaa
HBA UID SP Name SPPort
------- ------- ------
0 21
Storage Group Name: bbbb
HBA UID... (2 Replies)
Hi Gurus,
I have requirement need to sum the value, the logic is if the value is negative then time -1, I tried below two ways. one is failed, another one doesn't work.
awk -F"," '{if($8< 0 $8*-1 else $8) sum+=$8}{print sum, $8} END{printf("%.2f\n",sum)}'
awk -F","... (4 Replies)
Discussion started by: ken6503
4 Replies
LEARN ABOUT MOJAVE
curlopt_headerfunction
CURLOPT_HEADERFUNCTION(3) curl_easy_setopt options CURLOPT_HEADERFUNCTION(3)NAME
CURLOPT_HEADERFUNCTION - callback that receives header data
SYNOPSIS
#include <curl/curl.h>
size_t header_callback(char *buffer,
size_t size,
size_t nitems,
void *userdata);
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HEADERFUNCTION, header_callback);
DESCRIPTION
Pass a pointer to your callback function, which should match the prototype shown above.
This function gets called by libcurl as soon as it has received header data. The header callback will be called once for each header and
only complete header lines are passed on to the callback. Parsing headers is very easy using this. The size of the data pointed to by buf-
fer is size multiplied with nmemb. Do not assume that the header line is zero terminated! The pointer named userdata is the one you set
with the CURLOPT_HEADERDATA(3) option. This callback function must return the number of bytes actually taken care of. If that amount dif-
fers from the amount passed in to your function, it'll signal an error to the library. This will cause the transfer to get aborted and the
libcurl function in progress will return CURLE_WRITE_ERROR.
A complete HTTP header that is passed to this function can be up to CURL_MAX_HTTP_HEADER (100K) bytes.
If this option is not set, or if it is set to NULL, but CURLOPT_HEADERDATA(3) is set to anything but NULL, the function used to accept
response data will be used instead. That is, it will be the function specified with CURLOPT_WRITEFUNCTION(3), or if it is not specified or
NULL - the default, stream-writing function.
It's important to note that the callback will be invoked for the headers of all responses received after initiating a request and not just
the final response. This includes all responses which occur during authentication negotiation. If you need to operate on only the headers
from the final response, you will need to collect headers in the callback yourself and use HTTP status lines, for example, to delimit
response boundaries.
When a server sends a chunked encoded transfer, it may contain a trailer. That trailer is identical to a HTTP header and if such a trailer
is received it is passed to the application using this callback as well. There are several ways to detect it being a trailer and not an
ordinary header: 1) it comes after the response-body. 2) it comes after the final header line (CR LF) 3) a Trailer: header among the regu-
lar response-headers mention what header(s) to expect in the trailer.
For non-HTTP protocols like FTP, POP3, IMAP and SMTP this function will get called with the server responses to the commands that libcurl
sends.
DEFAULT
Nothing.
PROTOCOLS
Used for all protocols with headers or meta-data concept: HTTP, FTP, POP3, IMAP, SMTP and more.
EXAMPLE
static size_t header_callback(char *buffer, size_t size,
size_t nitems, void *userdata)
{
/* received header is nitems * size long in 'buffer' NOT ZERO TERMINATED */
/* 'userdata' is set with CURLOPT_HEADERDATA */
return nitems * size;
}
CURL *curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, header_callback);
curl_easy_perform(curl);
}
AVAILABILITY
Always
RETURN VALUE
Returns CURLE_OK
SEE ALSO CURLOPT_HEADERDATA(3), CURLOPT_WRITEFUNCTION(3),
libcurl 7.54.0 February 03, 2016 CURLOPT_HEADERFUNCTION(3)