Length of an indirect variable


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Length of an indirect variable
# 1  
Old 03-28-2006
Question Length of an indirect variable

The construct ${#parameter} returns the number of characters in the parameter and ${!parameter} specifies an indirect variable. My question is: How do I combine these two. What I want is ${#!parameter} but this gives an error.

Of course I can use:
dummy=${!parameter}
${#dummy}
but that's a bit ugly.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Convert variable length record to fixed length

Hi Team, I have an issue to split the file which is having special chracter(German Char) using awk command. I have a different length records in a file. I am separating the files based on the length using awk command. The command is working fine if the record is not having any... (7 Replies)
Discussion started by: Anthuvan
7 Replies

2. Shell Programming and Scripting

[Solved] How to increment and add variable length numbers to a variable in a loop?

Hi All, I have a file which has hundred of records with fixed number of fields. In each record there is set of 8 characters which represent the duration of that activity. I want to sum up the duration present in all the records for a report. The problem is the duration changes per record so I... (5 Replies)
Discussion started by: danish0909
5 Replies

3. Shell Programming and Scripting

Indirect variable assignment

Hi I have variable A_B=alpha also var1="A" var2="B" I want to retrieve the value alpha using var1 and var2 , somthing like echo ${${var1}_${var2}} that works. Obviously this is receiving syntax error (6 Replies)
Discussion started by: sumir
6 Replies

4. Shell Programming and Scripting

changing a variable length text to a fixed length

Hi, Can anyone help with a effective solution ? I need to change a variable length text field (between 1 - 18 characters) to a fixed length text of 18 characters with the unused portion, at the end, filled with spaces. The text field is actually field 10 of a .csv file however I could cut... (7 Replies)
Discussion started by: dc18
7 Replies

5. Linux

How to get an Indirect Variable Value..?

Hi, I've got a small problem. If varible A stores "B" and Variable B stores C, How to get the value of variable B by using only Variable A..? I tried the following but didnt work pease help.. $ var1=vikram $ echo $var1 vikram $ vikram=sampath $ echo $vikram sampath $ echo... (6 Replies)
Discussion started by: vickramshetty
6 Replies

6. Shell Programming and Scripting

Split variable length and variable format CSV file

Dear all, I have basic knowledge of Unix script and her I am trying to process variable length and variable format CSV file. The file length will depend on the numbers of Earnings/Deductions/Direct Deposits. And The format will depend on whether it is Earnings/Deductions or Direct Deposits... (2 Replies)
Discussion started by: chechun
2 Replies

7. Shell Programming and Scripting

Make variable length record a fixed length

Very, very new to unix scripting and have a unique situation. I have a file of records that contain 3 records types: (H)eader Records (D)etail Records (T)railer Records The Detail records are 82 bytes in length which is perfect. The Header and Trailer records sometimes are 82 bytes in... (3 Replies)
Discussion started by: jclanc8
3 Replies

8. UNIX for Dummies Questions & Answers

Convert a tab delimited/variable length file to fixed length file

Hi, all. I need to convert a file tab delimited/variable length file in AIX to a fixed lenght file delimited by spaces. This is the input file: 10200002<tab>US$ COM<tab>16/12/2008<tab>2,3775<tab>2,3783 19300978<tab>EURO<tab>16/12/2008<tab>3,28523<tab>3,28657 And this is the expected... (2 Replies)
Discussion started by: Everton_Silveir
2 Replies

9. UNIX for Advanced & Expert Users

Compound indirect variable references

Using bash, I'm trying to read a .properties file (name=value pairs), assigning an indirect variable reference for each line in the file. The trick is that a property's value string may contain the name of a property that occurred earlier in the file, and I want the name of the 1st property to... (5 Replies)
Discussion started by: tkrussel
5 Replies

10. Shell Programming and Scripting

creating a fixed length output from a variable length input

Is there a command that sets a variable length? I have a input of a variable length field but my output for that field needs to be set to 32 char. Is there such a command? I am on a sun box running ksh Thanks (2 Replies)
Discussion started by: r1500
2 Replies
Login or Register to Ask a Question
ARES_CREATE_QUERY(3)					     Library Functions Manual					      ARES_CREATE_QUERY(3)

NAME
ares_create_query - Compose a single-question DNS query buffer SYNOPSIS
#include <ares.h> int ares_create_query(const char *name, int dnsclass, int type, unsigned short id, int rd, unsigned char **buf, int *buflen, int max_udp_size) DESCRIPTION
The ares_create_query function composes a DNS query with a single question. The parameter name gives the query name as a NUL-terminated C string of period-separated labels optionally ending with a period; periods and backslashes within a label must be escaped with a backlash. The parameters dnsclass and type give the class and type of the query using the values defined in <arpa/nameser.h>. The parameter id gives a 16-bit identifier for the query. The parameter rd should be nonzero if recursion is desired, zero if not. The query will be placed in an allocated buffer, a pointer to which will be stored in the variable pointed to by buf, and the length of which will be stored in the variable pointed to by buflen. It is the caller's responsibility to free this buffer using ares_free_string(3) when it is no longer needed. The parameter max_udp_size should be nonzero to activate EDNS. Usage of ares_create_query(3) with max_udp_size set to zero is equivalent to ares_mkquery(3). RETURN VALUES
ares_create_query can return any of the following values: ARES_SUCCESS Construction of the DNS query succeeded. ARES_EBADNAME The query name name could not be encoded as a domain name, either because it contained a zero-length label or because it contained a label of more than 63 characters. ARES_ENOMEM Memory was exhausted. AVAILABILITY
Added in c-ares 1.10.0 SEE ALSO
ares_expand_name(3), ares_free_string(3) AUTHOR
17 Aug 2012 ARES_CREATE_QUERY(3)