01-21-2009
I answer to my self, I used split()
Thank you!
Carlos
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Dear friends,
I'm a novice Unix user and I'm trying to learn the ropes. I have a big task I have to accomplish and I'm convinced Unix can get the job done, I just haven't figured out how. I recently posted on the topic of cutting text between unique text patterns and somebody helped me a great... (24 Replies)
Discussion started by: spindoctor
24 Replies
2. Shell Programming and Scripting
Hi ,
a:) i have configuration file with pattren
<Range start no>,<Range end no>,<type of records to be extracted from the data file>,<name of the file to store output>
eg:
myfile.confg
9899000000,9899999999,DATA,b.dat
9899000000,9899999999,SMS,a.dat
b:) Stucture of my data file is... (3 Replies)
Discussion started by: suparnbector
3 Replies
3. Shell Programming and Scripting
Hi,
I have to perform an iterative function on a set of 10 files. After the first round the output files are named differently than the input files.
examples
input file name = xxxx1.yyy
output file name = xxxx1_0001.yyy
I need to rename all of the output files to the original input... (5 Replies)
Discussion started by: ligander
5 Replies
4. UNIX for Advanced & Expert Users
It would be highly appreciable if any one helps me in this. I am trying to get it done through Java but I love unix and believe it can be done within minutes with couple of lines.
The input log file is a text file contains multiple entries seperated by a blank line.
Each seperated entry... (7 Replies)
Discussion started by: hareeshram
7 Replies
5. Shell Programming and Scripting
Hi All,
I have some HTML files and my requirement is to extract all the anchor text words from the HTML files along with their URLs and store the result in a separate text file separated by space. For example, <a href="/kid/stay_healthy/">Staying Healthy</a>
which has /kid/stay_healthy/ as... (3 Replies)
Discussion started by: shoaibjameel123
3 Replies
6. Shell Programming and Scripting
Hi all,
I have two .txt file i.e.
First text file:
2
4
1
4
Second text file
2 1.nii.gz
4 334.nii.gz
1 12.nii.gz
4 134.nii.gz
If entry in 1st column of 1st text file matches the 1st column of 2nd text file, then copy the file (name of which is the second column) associated with... (4 Replies)
Discussion started by: vd24
4 Replies
7. Shell Programming and Scripting
Hi Everyone,
I'm really new to all this so I'm really hoping someone can help. I have a directory with ~1000 lists from which I want to extract lines from and write to new files. For simplicity lets say they are shopping lists and I want to write out the lines corresponding to apples to a new... (2 Replies)
Discussion started by: born2phase
2 Replies
8. Programming
i m unable to extract data from one text files to different text files..i am able to concat two text files in d same file
---------- Post updated at 03:21 PM ---------- Previous update was at 03:16 PM ----------
i want a c program for it (2 Replies)
Discussion started by: asd123
2 Replies
9. Shell Programming and Scripting
Hello there,
I am trying to extract (string) information ( a list words) from 4 files and then put the results into 1 file. Currently I am doing this using grep -f list.txt file1 . and repeat the process for the other 3 files. The reasons i am doing that (a) I do know how to code (b) each file... (4 Replies)
Discussion started by: houkto
4 Replies
10. Programming
Hello,
I extracted a list of files in a directory with the command ls . However this is not my computer, so the ls functionality has been revamped so that it gives the filesizes in front like this :
This is the output of ls command : I stored the output in a file filelist
1.1M... (5 Replies)
Discussion started by: ajayram
5 Replies
LEARN ABOUT MINIX
upscli_get
UPSCLI_GET(3) NUT Manual UPSCLI_GET(3)
NAME
upscli_get - retrieve data from a UPS
SYNOPSIS
#include <upsclient.h>
int upscli_get(UPSCONN_t *ups, int numq, const char **query,
int *numa, char ***answer)
DESCRIPTION
The upscli_get() function takes the pointer ups to a UPSCONN_t state structure, and the pointer query to an array of numq query elements.
It builds a properly-formatted request from those elements and transmits it to upsd(8).
Upon success, the response will be split into separate components. A pointer to those components will be returned in answer. The number of
usable answer components will be returned in numa.
USES
This function implements the "GET" command in the protocol. As a result, you can use it to request many different things from the server.
Some examples are:
o GET NUMLOGINS <ups>
o GET UPSDESC <ups>
o GET VAR <ups> <var>
o GET TYPE <ups> <var>
o GET DESC <ups> <var>
o GET CMDDESC <ups> <cmd>
QUERY FORMATTING
To generate a request for GET NUMLOGINS su700, you would populate query and numq as follows:
int numq;
const char *query[2];
query[0] = "NUMLOGINS";
query[1] = "su700";
numq = 2;
All escaping of special characters and quoting of elements with spaces is handled for you inside this function.
ANSWER FORMATTING
The raw response from upsd to the above query would be NUMLOGINS su700 1. Since this is split up for you, the values work out like this:
numa = 3;
answer[0] = "NUMLOGINS"
answer[1] = "su700"
answer[2] = "1"
Notice that the value which you seek typically starts at answer[numq].
ERROR CHECKING
This function will check your query against the response from upsd(8). For example, if you send "VAR" "su700" "ups.status", it will expect
to see those at the beginning of the response.
If the results from upsd do not pass this case-insensitive test against your request, this function will return an error. When this
happens, upscli_upserror(3) will return UPSCLI_ERR_PROTOCOL.
ANSWER ARRAY LIFETIME
The pointers contained within the answer array are only valid until the next call to a upsclient function which references them. If you
need to use data from multiple calls, you must copy it somewhere else first.
The answer array and its elements may change locations, so you must not rely on previous addresses. You must only use the addresses which
were returned by the most recent call. You also must not attempt to use more than numa elements in answer. Such behavior is undefined, and
may yield bogus data or a crash.
The array will be deleted after calling upscli_disconnect(3). Any access after that point is also undefined.
RETURN VALUE
The upscli_get() function returns 0 on success, or -1 if an error occurs.
SEE ALSO
upscli_list_start(3), upscli_list_next(3), upscli_strerror(3), upscli_upserror(3)
Network UPS Tools 05/22/2012 UPSCLI_GET(3)