Sponsored Content
Top Forums Shell Programming and Scripting Convertin IP adresses from a column to a raw + add a comma between addresses Post 302690205 by oliv66 on Wednesday 22nd of August 2012 03:38:01 PM
Old 08-22-2012
many thanks to both of you for your quick response. you have the right answer for my issue.
 

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

convertin in to upper case

write a shell script that accepts one or more file name as arguments and converts all of them to uppercase,provided they exist in the current directory:b::b::b: (2 Replies)
Discussion started by: shawz
2 Replies

2. Shell Programming and Scripting

subtitute value of certain raw and column with sed

Dear All, For example the content of data.txt file is: 1 1 23 2 1 42 3 2 52 4 2 62 5 1 77 6 1 88 7 2 99 8 1 100 Could I substitute 2 in second column with 1 using sed commad so that the data will be change as follow ? 1 1 23 2 1 42 ... (1 Reply)
Discussion started by: ariesto
1 Replies

3. Shell Programming and Scripting

rearrange the column names with comma as column delimiter

Hi, I am new to shell scripting, i have requirement can any one help me out in this regrads, in directory i have file like invoice1.txt, invoice2.txt in each file i have fixed number of columns, 62 in number but they are randomly arranged.like for first file invoice1.txt can have columns... (5 Replies)
Discussion started by: madhav62
5 Replies

4. Shell Programming and Scripting

Replace pipe <|> with comma <,> in a column

Hi All Gurus, I need to replace a pipe <|> with a comma <,> in a few columns with pipe delimited file. The column name are fixed for the replacement of comma <,>. For below example, Col3, Col6 and Col8 are columns need to replace with comma <,> if any pipe encountered. example:... (14 Replies)
Discussion started by: agathaeleanor
14 Replies

5. Shell Programming and Scripting

Substituting comma "," for dot "." in a specific column when comma"," is a delimiter

Hi, I'm dealing with an issue and losing a lot of hours figuring out how i would solve this. I have an input file which looks like this: ('BLABLA +200-GRS','Serviço ','TarifaçãoServiço','wap.bla.us.0000000121',2985,0,55,' de conversão em escada','Dia','Domingos') ('BLABLA +200-GRR','Serviço... (6 Replies)
Discussion started by: poliver
6 Replies

6. Shell Programming and Scripting

Insert comma in place of column

Hi all, I have a file in which I have to insert commna between entries of 2 column and createa new file separated by commas not a columns if input is FHIT Adenosine Monotungstate Not Available CS Trifluoroacetonyl Coenzyme A Not Available Theo expected output is ... (5 Replies)
Discussion started by: manigrover
5 Replies

7. Shell Programming and Scripting

How to use regex on particular column (Removing comma from particular column)?

Hi, I have pipe separated file which contains some data having comma(,) in it. I want to remove the comma(,) only from particular column without changing data in other columns. Below is the sample data file, I want to remove the comma(,) only from 5th column. $ cat file1 ABC | DEF, HIJ|... (6 Replies)
Discussion started by: Prathmesh
6 Replies

8. Shell Programming and Scripting

Bring values in the second column into single line (comma sep) for uniq value in the first column

I want to bring values in the second column into single line for uniq value in the first column. My input jvm01, Web 2.0 Feature Pack Library jvm01, IBM WebSphere JAX-RS jvm01, Custom01 Shared Library jvm02, Web 2.0 Feature Pack Library jvm02, IBM WebSphere JAX-RS jvm03, Web 2.0 Feature... (10 Replies)
Discussion started by: kchinnam
10 Replies
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)
All times are GMT -4. The time now is 05:46 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy