Sponsored Content
Top Forums Shell Programming and Scripting Assign comma separated values to a variable Post 302994936 by jeffs42885 on Wednesday 29th of March 2017 02:36:40 PM
Old 03-29-2017
Thank you all so much for your help. I reviewed a few of these, and I think that the most efficient way of doing this is using:

Code:
cut

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Splitting comma separated values into an array

I'm attempting to create a KSH array out of a string like this: ",,,value1,value2,," I have created the array but I only get two elements, one for value1 and one for value2. I have ended up with something like this but I don't like it: set -A JUNK xx=0 for i in $(print ",,,value1,value2,,"... (3 Replies)
Discussion started by: tmarikle
3 Replies

2. Shell Programming and Scripting

Extracting the values separated by comma

Hi, I have a variable which has a list of string separated by comma. for ex , Variable=/usr/bin,/usr/smrshbin,/tmp How can i get the values between the commas separately using shell scripts.Please help me. Thanks, Padmini. (6 Replies)
Discussion started by: padmisri
6 Replies

3. Shell Programming and Scripting

Input Validation of comma separated values

Hello all, I am working on a script and have the first part solved of numerical input validation. Below the code validates that the input is a numerical value between 100 and 1000. If not, it errors out. Now I need to be able to read values separated by a comma. For example, instead of my... (5 Replies)
Discussion started by: LinuxRacr
5 Replies

4. Shell Programming and Scripting

To agregate Comma separated values

Hi pls help me to get the code: i have a file in which content is : 2.01304E+11 2.01304E+11 ori 2 01:00 2.01304E+11 2.01304E+11 ori 2 01:02 2.01304E+11 2.01304E+11 ori 3 01:02 2.01304E+11 2.01304E+11 ori 3 ... (7 Replies)
Discussion started by: Aditya.Gurgaon
7 Replies

5. UNIX for Dummies Questions & Answers

[solved] Comma separated values to space separated

Hi, I have a large number of files which are written as csv (comma-separated values). Does anyone know of simple sed/awk command do achieve this? Thanks! ---------- Post updated at 10:59 AM ---------- Previous update was at 10:54 AM ---------- Guess I asked this too soon. Found the... (0 Replies)
Discussion started by: lost.identity
0 Replies

6. Shell Programming and Scripting

Needs help in parsing comma separated values

hello experts, i am retrieving values in variables jobKey and jobName within my shell script. these values are returned to me within braces and i am using following command to remove those braces: jobKeys=`echo $jobKeys | sed 's:^.\(.*\).$:\1:'` jobNames=`echo $jobNames | sed... (1 Reply)
Discussion started by: avikaljain
1 Replies

7. Shell Programming and Scripting

Read record from the text file contain multiple separated values & assign those values to variables

I have a file containing multiple values, some of them are pipe separated which are to be read as separate values and some of them are single value all are these need to store in variables. I need to read this file which is an input to my script Config.txt file name, first path, second... (7 Replies)
Discussion started by: ketanraut
7 Replies

8. Shell Programming and Scripting

Comma separated values to individual lines

My OS : RHEL 6.7 I have a text file with comma separated values like below $ cat testString.txt 'JOHN' , 'KEITH' , 'NEWMAN' , 'URSULA' , 'ARIANNA' , 'CHENG', . . . . I want these values to appear like below 'JOHN' , 'KEITH' , 'NEWMAN' , 'URSULA' , 'ARIANNA' , 'CHENG', .... (4 Replies)
Discussion started by: kraljic
4 Replies

9. Shell Programming and Scripting

Parsing Comma Separated values to UNIX variable from PLSQL

Hi All, I'm trying to pass the comma separated values (string) returned from Plsql Procedure to UNIX variable. getting the below log message cat: -: Bad file descriptor awk: cmd. line:1: fatal: error reading input file `-': Bad file descriptor The output coming from plsql procedure is... (3 Replies)
Discussion started by: Mahesh3089
3 Replies

10. Shell Programming and Scripting

Convert fixed value fields to comma separated values

Hi All, Hope you are doing Great!!!. Today i have came up with a problem to say exactly it was for performance improvement. I have written code in perl as a solution for this to cut in specific range, but it is taking time to run for files thousands of lines so i am expecting a sed... (9 Replies)
Discussion started by: mad man
9 Replies
NODEATTR(1)							     NODEATTR							       NODEATTR(1)

NAME
nodeattr - query genders file SYNOPSIS
nodeattr [-f genders] [-q | -c | -n | -s] [-X exclude_query] query nodeattr [-f genders] [-q | -c | -n | -s] -A nodeattr [-f genders] [-v] [node] attr[=val] nodeattr [-f genders] -Q [node] query nodeattr [-f genders] -V [-U] attr nodeattr [-f genders] -l [node] nodeattr [-f genders] -k nodeattr [-f genders] -d genders nodeattr [-f genders] --expand nodeattr [-f genders] --compress DESCRIPTION
When invoked with the -q , -c , -n , or -s arguments, nodeattr reads the genders file and outputs a list of nodes that match the specified query. The nodes are listed in hostlist format, comma separated lists, newline separated lists, or space separated lists respectively. Genders queries will query the genders database for a set of nodes based on the union, intersection, difference, or complement of genders attributes and values. The set operation union is represented by two pipe symbols ('||'), intersection by two ampersand symbols ('&&'), difference by two minus symbols ('--'), and complement by a tilde ('~'). Parentheses may be used to change the order of operations. The -X argument and query can be used to exclude nodes from the resulting output. A query can be replaced with the -A option to cause nodeattr to print all the nodes listed in the genders database. When called with a node name (optional) and attribute name, nodeattr returns 0 to the environment if the node has the attribute; else 1. If -v is present, the attribute name and any value (see below) is printed on the standard output. If a node name is not specified, the local host is assumed. When called with the -Q argument, nodeattr will check if the node name (optional) is met by the attribute and value conditions specified in the query. If the conditions are met, nodeattr returns 0 to the environment; else 1. The query format is identical to the format listed above. If a node name is not specified, the local host is assumed. The -V option causes nodeattr to print all of the values that exist for a particular attribute. Also specifing -U with -V causes nodeattr to print out only unique values for the particular attribute. The -l option causes nodeattr to print the attributes of the specified node. If no node is listed, all attributes in the genders file are listed. The -k option checks the genders file for parse errors and proper formatting. If errors are found, information about the error will be output to standard error. Nodeattr will always check the default genders file, but a different genders file can be specified with the -f option. The -d option allows the specified genders database to be compared to the filename indicated by the -f option or the default genders data- base. The differences contained in the specified database will be output to standard error. The --expand option will take a genders database, expand all hostranges, and output a new genders database. The subsequent database will be identical to the first, but every node will be listed on a separate line. This option may be useful for debugging or determining the difference between databases. The --compress is opposite of the --expand option. It will output a new identical genders database with hostranges of nodes with identical attributes. Depending on the setup of your genders database, the resulting database may be longer or shorter. This option may be useful as a beginning step to compressing an existing genders database. Attribute names may optionally appear in the genders file with an equal sign followed by a value. Nodeattr ignores these values except when the -v option requests that the value, if any, be displayed; and when an attribute is specified on the command line with a value, in which case only an attribute with the specified value in the genders file will match. EXAMPLES
Retrieve a comma separated list of all login nodes: nodeattr -c login Retrieve a hostlist formatted list of all login nodes: nodeattr -q login Retrieve a comma separated list of nodes with 4 cpus: nodeattr -c cpus=4 Retrieve a comma separated list of all login and management nodes: nodeattr -c "login||mgmt" Retrieve a comma separated list of all login nodes with 4 cpus: nodeattr -c "login&&cpus=4" Retrieve a comma separated list of all nodes that are not login or management nodes: nodeattr -c "~(login||mgmt)" To use nodeattr with pdsh to run a command on all fddi nodes: pdsh -w`nodeattr -c fddi` command To use nodeattr in a ksh script to collect a list of users on login nodes: for i in `nodeattr -n login`; do rsh $i who; done To verify whether or not this node is a head node: nodeattr head && echo yes To verify whether or not this node is a head node and ntpserver: nodeattr -Q "head&&ntpserver" && echo yes FILES
/etc/genders SEE ALSO
libgenders(3) LLNL
August 2003 NODEATTR(1)
All times are GMT -4. The time now is 11:54 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy