Sponsored Content
Full Discussion: AWK syntax question
Top Forums UNIX for Dummies Questions & Answers AWK syntax question Post 302251845 by Leo_NN on Tuesday 28th of October 2008 08:59:06 AM
Old 10-28-2008
object_list="CUSTOMER ADDRESS TELEPHONE"

Here I wanted to check if $3 is in the object_list, not equal, but part of it.
For instance if $3="CUSTOMER" - OK.
So I need something like IN or *$3* syntax, I think.

thanks.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk syntax question

Hi there could someone explain what is happening in the following function/statement for me, im just a little confused code = 'BEGIN{FS=","} { printf ("%-11s,%s%s%s,%07.2f,%14s,%-3s\n",$1,substr($2,9,2),substr($2,6,2),substr($ 2,3,2),$9,$10,$12) } this function is called later in the... (2 Replies)
Discussion started by: hcclnoodles
2 Replies

2. Shell Programming and Scripting

yet another awk field syntax question

I am trying to print the remaing fields and field numbers beginning with a field 'xyz' #cat abc test1:test2:xyz:test3:test4:test5 #cat def test1:test2:test3:xyz:test4:test5 desired output is to be able to print NF and any trailing fields separated by':' test3 3 or test4 3 or test5... (4 Replies)
Discussion started by: prkfriryce
4 Replies

3. Shell Programming and Scripting

awk syntax question

Hi I use awk command to delete the first blanc line of a file: awk '/^$/ && !f{f=1;next}1' infile > outfile can somebody please explain me what the last "1'" in !f{f=1;next}1' stands for... Thansk a lot -A (3 Replies)
Discussion started by: aoussenko
3 Replies

4. Shell Programming and Scripting

OR operator syntax question in AWK script

Hi guys, I confused about syntax used in OR script as follow: I have this sample file separated by "|" containing: January|Month No. 1 February|Month No. 2 March|Month No. 3 April|Month No. 4 May|Month No. 5 June|Month No. 6 July|Month No. 7 August|Month No. 8 September|Month No. 9... (11 Replies)
Discussion started by: cgkmal
11 Replies

5. Shell Programming and Scripting

syntax question in regards to nested awk statements

Hello all, I am writing up an input file and I was hoping I could get some guidance as to how to best consolidate these 2 awk statements for 1 while loop. Here's my input file # cat databases.lst #NOTE: These entries are delimited by tabs "\t" #oracleSID name/pass # db11 ... (2 Replies)
Discussion started by: Keepcase
2 Replies

6. UNIX for Advanced & Expert Users

SNMP syntax question

Hello, I need to create an snmp.comf file that defines 2 IPs to the same community string. Do I need to have 2 community strings with the same name and diff't IPs? Or should I have 1 string and list the IPs? (comma seperated?) Example: rocommunity EC_8000_RO arguments EC_8000_RO... (2 Replies)
Discussion started by: felbvts
2 Replies

7. Shell Programming and Scripting

tar -C syntax question

I am writing a perl script to tar multiple files (in unix) from a given directory to a given output directory. I do NOT want the file path included in the tar, so I've flagged the -C option. Example: tar -cvf tar/1.tar -C htmp/source/ 1-1-1.xml However, I need to do this for a number of target... (3 Replies)
Discussion started by: michanjohns
3 Replies

8. Shell Programming and Scripting

Question about syntax error

first of all.. sorry about all the question bombing.. im bored atm so im currently playing around with sh scripting hehe s = `expr ls -s Documents | grep Music | awk '{ print $1 }' ` t = `expr $t + $s` it give syntax error s not found t not found lol... any idea why? (7 Replies)
Discussion started by: Nick1097
7 Replies

9. Programming

Perl syntax question

Hallo everybody, I have a following problem - I'm doing a map funciont to fill in a HTML table and I want to use some radiobutton groups. Unfortunatelly, they are grouped by names, so I have to add some "counter" that will divide one row from another, and I'm using CGI.pm for generating the... (3 Replies)
Discussion started by: duskos
3 Replies

10. Shell Programming and Scripting

Question regarding quotation syntax

Hey guys, my first post on UNIX Forums(much overdue IMO)! I've got this bit of code that doesn't seem to be working correctly for an Android app I'm working on: "screen -S gmod1 -p 0 -X stuff " & "" & command.text & "`echo -ne '\015'`""" Basically it types command.text(variable determined... (4 Replies)
Discussion started by: stingwraith
4 Replies
MakeMethods::Emulator::MethodMaker(3pm) 		User Contributed Perl Documentation		   MakeMethods::Emulator::MethodMaker(3pm)

NAME
Class::MakeMethods::Emulator::MethodMaker - Emulate Class::MethodMaker SYNOPSIS
package MyObject; use Class::MakeMethods::Emulator::MethodMaker( new_with_init => 'new', get_set => [ qw / foo bar baz / ]; ); ... OR ... package MyObject; use Class::MakeMethods::Emulator::MethodMaker '-take_namespace'; use Class::MethodMaker ( new_with_init => 'new', get_set => [ qw / foo bar baz / ]; ); DESCRIPTION
This module provides emulation of Class::MethodMaker, using the Class::MakeMethods framework. Although originally based on Class::MethodMaker, the calling convention for Class::MakeMethods differs in a variety of ways; most notably, the names given to various types of methods have been changed, and the format for specifying method attributes has been standardized. This package uses the aliasing capability provided by Class::MakeMethods, defining methods that modify the declaration arguments as necessary and pass them off to various subclasses of Class::MakeMethods. COMPATIBILITY
Full compatibility is maintained with version 1.03; some of the changes in versions 1.04 through 1.10 are not yet included. The test suite from Class::MethodMaker version 1.10 is included with this package, in the t/emulator_class_methodmaker/ directory. The unsupported tests have names ending in ".todo". The tests are unchanged from those in the Class::MethodMaker distribution, except for the substitution of "Class::MakeMethods::Emulator::MethodMaker" in the place of "Class::MethodMaker". In cases where earlier distributions of Class::MethodMaker contained a different version of a test, it is also included. (Note that version 0.92's get_concat returned '' for empty values, but in version 0.96 this was changed to undef; this emulator follows the later behavior. To avoid "use of undefined value" warnings from the 0.92 version of get_concat.t, that test has been modified by appending a new flag after the name, 'get_concat --noundef', which restores the earlier behavior.) USAGE
There are several ways to call this emulation module: o Direct Access Replace occurances in your code of "Class::MethodMaker" with "Class::MakeMethods::Emulator::MethodMaker". o Install Emulation If you "use Class::MakeMethods::Emulator::MethodMaker '-take_namespace'", the Class::MethodMaker namespace will be aliased to this package, and calls to the original package will be transparently handled by this emulator. To remove the emulation aliasing, call "use Class::MakeMethods::Emulator::MethodMaker '-release_namespace'". Note: This affects all subsequent uses of Class::MethodMaker in your program, including those in other modules, and might cause unexpected effects. o The -sugar Option Passing '-sugar' as the first argument in a use or import call will cause the 'methods' package to be declared as an alias to this one. This allows you to write declarations in the following manner. use Class::MakeMethods::Emulator::MethodMaker '-sugar'; make methods get_set => [ qw / foo bar baz / ], list => [ qw / a b c / ]; Note: This feature is deprecated in Class::MethodMaker version 0.96 and later. METHOD CATALOG
NOTE: The documentation below is derived from version 1.02 of Class::MethodMaker. Class::MakeMethods::Emulator::MethodMaker provides support for all of the features and examples shown below, with no changes required. CONSTRUCTOR METHODS
new Equivalent to Class::MakeMethods 'Template::Hash:new --with_values'. new_with_init Equivalent to Class::MakeMethods 'Template::Hash:new --with_init'. new_hash_init Equivalent to Class::MakeMethods 'Template::Hash:new --instance_with_methods'. new_with_args Equivalent to Class::MakeMethods 'Template::Hash:new --with_values'. copy Equivalent to Class::MakeMethods 'Template::Hash:new --copy_with_values'. SCALAR ACCESSORS
get_set Basically equivalent to Class::MakeMethods 'Template::Hash:scalar', except that various arguments are intercepted and converted into the parallel Class::MakeMethods::Template interface declarations. get_concat Equivalent to Class::MakeMethods 'Template::Hash:string' with a special interface declaration that provides the get_concat and clear behaviors. counter Equivalent to Class::MakeMethods 'Template::Hash:number --counter'. OBJECT ACCESSORS
Basically equivalent to Class::MakeMethods 'Template::Hash:object' with an declaration that provides the "delete_x" interface. Due to a difference in expected argument syntax, the incoming arguments are revised before being delegated to Template::Hash:object. object_list Basically equivalent to Class::MakeMethods 'Template::Hash:object_list' with an declaration that provides the relevant helper methods. Due to a difference in expected argument syntax, the incoming arguments are revised before being delegated to Template::Hash:object_list. forward Basically equivalent to Class::MakeMethods 'Template::Universal:forward_methods'. Due to a difference in expected argument syntax, the incoming arguments are revised before being delegated to Template::Universal:forward_methods. forward => [ comp => 'method1', comp2 => 'method2' ] Define pass-through methods for certain fields. The above defines that method "method1" will be handled by component "comp", whilst method "method2" will be handled by component "comp2". REFERENCE ACCESSORS
list Equivalent to Class::MakeMethods 'Template::Hash:array' with a custom method naming interface. hash Equivalent to Class::MakeMethods 'Template::Hash:hash' with a custom method naming interface. tie_hash Equivalent to Class::MakeMethods 'Template::Hash:tiedhash' with a custom method naming interface. hash_of_lists Equivalent to Class::MakeMethods 'Template::Hash:hash_of_arrays', or if the -static flag is present, to 'Template::Static:hash_of_arrays'. STATIC ACCESSORS
static_get_set Equivalent to Class::MakeMethods 'Template::Static:scalar' with a custom method naming interface. static_list Equivalent to Class::MakeMethods 'Template::Static:array' with a custom method naming interface. static_hash Equivalent to Class::MakeMethods 'Template::Static:hash' with a custom method naming interface. GROUPED ACCESSORS
boolean Equivalent to Class::MakeMethods 'Template::Static:bits' with a custom method naming interface. grouped_fields Creates get/set methods like get_set but also defines a method which returns a list of the slots in the group. use Class::MakeMethods::Emulator::MethodMaker grouped_fields => [ some_group => [ qw / field1 field2 field3 / ], ]; Its argument list is parsed as a hash of group-name => field-list pairs. Get-set methods are defined for all the fields and a method with the name of the group is defined which returns the list of fields in the group. struct Equivalent to Class::MakeMethods 'Template::Hash::struct'. Note: This feature is included but not documented in Class::MethodMaker version 1. INDEXED ACCESSORS
listed_attrib Equivalent to Class::MakeMethods 'Template::Flyweight:boolean_index' with a custom method naming interface. key_attrib Equivalent to Class::MakeMethods 'Template::Hash:string_index'. key_with_create Equivalent to Class::MakeMethods 'Template::Hash:string_index --find_or_new'. CODE ACCESSORS
code Equivalent to Class::MakeMethods 'Template::Hash:code'. method Equivalent to Class::MakeMethods 'Template::Hash:code --method'. abstract Equivalent to Class::MakeMethods 'Template::Universal:croak --abstract'. ARRAY CONSTRUCTOR AND ACCESSORS
builtin_class (EXPERIMENTAL) Equivalent to Class::MakeMethods 'Template::StructBuiltin:builtin_isa' with a modified argument order. CONVERSION
If you wish to convert your code from use of the Class::MethodMaker emulator to direct use of Class::MakeMethods, you will need to adjust the arguments specified in your "use" or "make" calls. Often this is simply a matter of replacing the names of aliased method-types listed below with the new equivalents. For example, suppose that you code contained the following declaration: use Class::MethodMaker ( counter => [ 'foo' ] ); Consulting the listings below you can find that "counter" is an alias for "Hash:number --counter" and you could thus revise your declaration to read: use Class::MakeMethods ( 'Hash:number --counter' => [ 'foo' ] ); However, note that those methods marked "(with custom interface)" below have a different default naming convention for helper methods in Class::MakeMethods, and you will need to either supply a similar interface or alter your module's calling interface. Also note that the "forward", "object", and "object_list" method types, marked "(with modified arguments)" below, require their arguments to be specified differently. See Class::MakeMethods::Template::Generic for more information about the default interfaces of these method types. Hash methods The following equivalencies are declared for old meta-method names that are now handled by the Hash implementation: new 'Template::Hash:new --with_values' new_with_init 'Template::Hash:new --with_init' new_hash_init 'Template::Hash:new --instance_with_methods' copy 'Template::Hash:copy' get_set 'Template::Hash:scalar' (with custom interfaces) counter 'Template::Hash:number --counter' get_concat 'Template::Hash:string --get_concat' (with custom interface) boolean 'Template::Hash:bits' (with custom interface) list 'Template::Hash:array' (with custom interface) struct 'Template::Hash:struct' hash 'Template::Hash:hash' (with custom interface) tie_hash 'Template::Hash:tiedhash' (with custom interface) hash_of_lists 'Template::Hash:hash_of_arrays' code 'Template::Hash:code' method 'Template::Hash:code --method' object 'Template::Hash:object' (with custom interface and modified arguments) object_list 'Template::Hash:array_of_objects' (with custom interface and modified arguments) key_attrib 'Template::Hash:string_index' key_with_create 'Template::Hash:string_index --find_or_new' Static methods The following equivalencies are declared for old meta-method names that are now handled by the Static implementation: static_get_set 'Template::Static:scalar' (with custom interface) static_hash 'Template::Static:hash' (with custom interface) Flyweight method The following equivalency is declared for the one old meta-method name that us now handled by the Flyweight implementation: listed_attrib 'Template::Flyweight:boolean_index' Struct methods The following equivalencies are declared for old meta-method names that are now handled by the Struct implementation: builtin_class 'Template::Struct:builtin_isa' Universal methods The following equivalencies are declared for old meta-method names that are now handled by the Universal implementation: abstract 'Template::Universal:croak --abstract' forward 'Template::Universal:forward_methods' (with modified arguments) EXTENDING
In order to enable third-party subclasses of MethodMaker to run under this emulator, several aliases or stub replacements are provided for internal Class::MethodMaker methods which have been eliminated or renamed. o install_methods - now simply return the desired methods o find_target_class - now passed in as the target_class attribute o ima_method_maker - no longer supported; use target_class instead BUGS
This module aims to provide a 100% compatible drop-in replacement for Class::MethodMaker; if you detect a difference when using this emulation, please inform the author. SEE ALSO
See Class::MakeMethods for general information about this distribution. See Class::MakeMethods::Emulator for more about this family of subclasses. See Class::MethodMaker for more information about the original module. A good introduction to Class::MethodMaker is provided by pages 222-234 of Object Oriented Perl, by Damian Conway (Manning, 1999). http://www.browsebooks.com/Conway/ perl v5.10.1 2004-09-06 MakeMethods::Emulator::MethodMaker(3pm)
All times are GMT -4. The time now is 03:37 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy