Sponsored Content
Full Discussion: awk computed variable names
Top Forums Shell Programming and Scripting awk computed variable names Post 302164326 by fpmurphy on Monday 4th of February 2008 12:53:44 PM
Old 02-04-2008
The following code snippet outputs "wooket"

Code:
#!/usr/bin/awk -f

BEGIN {
    bar="wooket";
    foo=bar;
}

END { print foo }

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Variable names

Hi I have several variables called var1, var2, var3, var4 and so on. I would like to examine the contents of the variables using a loop and a variable called num which equals a figure eg num=3 I wanted to do something like echo $var$num to display the contents of var3 (4 Replies)
Discussion started by: Bab00shka
4 Replies

2. UNIX for Dummies Questions & Answers

Variable assignment for file names.

I am trying to process error files in selected directories. I can count the files that are there and export the contents to a file for either emailing or printing. The next step is to move the files to a processed directory with the name changed to .fixed as the last extension. for file in... (2 Replies)
Discussion started by: jagannatha
2 Replies

3. UNIX for Dummies Questions & Answers

Variable names

Hi, I have a variable v_iteration which can equal any 3 digit number eg 001 or 926 I would like to dynamically make a new variable name up using this 3 digit number eg v_another_variable_001=fred v_another_variable_926=joe The following are examples of what I have tried ... (2 Replies)
Discussion started by: Bab00shka
2 Replies

4. UNIX for Dummies Questions & Answers

Variable Names With Numbers

Hi Everyone, I was just curious if you are allowed to begin a variable name with a number. For example, I would really like to have the variable 8DAY_AVERAGE. But my shell script only seems to allow EIGHTDAY_AVERAGE. Is there a way I can get the former to work? I am using bash. Thanks a lot! ... (1 Reply)
Discussion started by: msb65
1 Replies

5. Shell Programming and Scripting

Variable names within array call

I am trying to write a piece of code that will call a value from an array. There are multiple arrays that I need to call data from. Only one array needs to be used based on the step within the program. The arrays have the names "cue_0", "cue_1", and so on. I can't figure out how to call a value... (2 Replies)
Discussion started by: vockleya
2 Replies

6. Shell Programming and Scripting

File Names in a Variable in a loop

Hi All , I am having confusion in a shell script. Please guide me. I need to get multiple files (number of files vary time to time, file names are separated by '|') using FTP get from the remote server. Actually, i call the FTP function in a loop. At the last step, i need to move all the get... (3 Replies)
Discussion started by: spkandy
3 Replies

7. UNIX for Dummies Questions & Answers

Incrementing Variable Names

Hi, I am using BASH. I have encountered a situation where the following is necessary (but I am not sure how to do it): #Define multiple arrays, whose names only differ by a number: ARRAY_1=(1 2 3) ARRAY_2=(4 5 6) ARRAY_3=(7 8 9) #Define ARRAY_AMOUNT, the number of arrays. In this case... (1 Reply)
Discussion started by: msb65
1 Replies

8. Shell Programming and Scripting

[SHELL: /bin/sh] For loop using variable variable names

Simple enough problem I think, I just can't seem to get it right. The below doesn't work as intended, it's just a function defined in a much larger script: CheckValues() { for field in \ Group_ID \ Group_Title \ Rule_ID \ Rule_Severity \ ... (2 Replies)
Discussion started by: Vryali
2 Replies

9. Shell Programming and Scripting

Indexing Variable Names

Hi All I think I might have bitten off more than I can chew here and I'm hoping some of you guys with advanced pattern matching skills can help me. What I want to do is index the occurrence of variable names within a library of scripts that I have. Don't ask why, I'm just sad like that... ... (3 Replies)
Discussion started by: bbq
3 Replies

10. Solaris

How is Load Average computed and what are better numbers?

Hello All, What is load average and how is it computed in Solaris 10? What are the different ranges for normal, warning and danger signs? Kindly clarify. Thank you, Sunil Kumar (3 Replies)
Discussion started by: msgforsunil
3 Replies
Text::Glob(3)						User Contributed Perl Documentation					     Text::Glob(3)

NAME
Text::Glob - match globbing patterns against text SYNOPSIS
use Text::Glob qw( match_glob glob_to_regex ); print "matched " if match_glob( "foo.*", "foo.bar" ); # prints foo.bar and foo.baz my $regex = glob_to_regex( "foo.*" ); for ( qw( foo.bar foo.baz foo bar ) ) { print "matched: $_ " if /$regex/; } DESCRIPTION
Text::Glob implements glob(3) style matching that can be used to match against text, rather than fetching names from a filesystem. If you want to do full file globbing use the File::Glob module instead. Routines match_glob( $glob, @things_to_test ) Returns the list of things which match the glob from the source list. glob_to_regex( $glob ) Returns a compiled regex which is the equivalent of the globbing pattern. glob_to_regex_string( $glob ) Returns a regex string which is the equivalent of the globbing pattern. SYNTAX
The following metacharacters and rules are respected. "*" - match zero or more characters "a*" matches "a", "aa", "aaaa" and many many more. "?" - match exactly one character "a?" matches "aa", but not "a", or "aaa" Character sets/ranges "example.[ch]" matches "example.c" and "example.h" "demo.[a-c]" matches "demo.a", "demo.b", and "demo.c" alternation "example.{foo,bar,baz}" matches "example.foo", "example.bar", and "example.baz" leading . must be explictly matched "*.foo" does not match ".bar.foo". For this you must either specify the leading . in the glob pattern (".*.foo"), or set $Text::Glob::strict_leading_dot to a false value while compiling the regex. "*" and "?" do not match / "*.foo" does not match "bar/baz.foo". For this you must either explicitly match the / in the glob ("*/*.foo"), or set $Text::Glob::strict_wildcard_slash to a false value with compiling the regex. BUGS
The code uses qr// to produce compiled regexes, therefore this module requires perl version 5.005_03 or newer. AUTHOR
Richard Clamp <richardc@unixbeard.net> COPYRIGHT
Copyright (C) 2002, 2003, 2006, 2007 Richard Clamp. All Rights Reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. SEE ALSO
File::Glob, glob(3) perl v5.18.2 2017-10-06 Text::Glob(3)
All times are GMT -4. The time now is 08:45 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy