Anybody know what's wrong with this syntax?
awk -v job="$job" 'BEGIN { FS="|"}
{print $1,$2," ",$4," ",$3\n,$5,"\n"}' list
It's keeping give me this message:
awk: syntax error near line 1
awk: bailing out near line 1
It seems awk has problem with my BEGIN command.
Any... (8 Replies)
Does anybody know how to print a variable passed to awk command?
awk -F"|" 'BEGIN {print $job,"\n","Question \n"} {print $1,$2$4," ",$3}' "job=$job1" file1
I am trying to pass job the variable job1.
the output is blank.
?? (3 Replies)
I'm an experienced awk user, but this one has me stumped. I have an awk script which is called from a UNIX command line as you'd expect:
myscript.awk -v foo=$1 -v bar=$2 filename
My question is this: is there a mechanism for determining the names of the -v variables within a script?
... (3 Replies)
Hello,
I have a case where I need to process an environment variable text value in CShell to calculate the product of 2 numbers stated in the variable string having the format "<first_number>Letter x<second_number>".
Ex: $VAR = "24x20"
I need to set $VAR_PRODUCT = "Product of 20 and 24"... (3 Replies)
Hello,
I extracted a list of files in a directory with the command ls . However this is not my computer, so the ls functionality has been revamped so that it gives the filesizes in front like this :
This is the output of ls command : I stored the output in a file filelist
1.1M... (5 Replies)
I wrote a very simple script to understand how to call user-defined functions from within awk after reading this post.
function my_func_local {
echo "In func $1"
}
export -f my_func_local
echo $1 | awk -F"/" '{for (k=1;k<=NF;k++) {
if ($k == "a" ) {
system("my_local_func $k")
}
else{... (19 Replies)
I have a file that has 2 fields called b_file:
11977 DAR.V3.20150209.1.CSV
3295 DAR.V3.20150209.1.CSV
1721 DAR.V2.20150210.1.CSV
I need to search a sftplog using the field 1, but want to maintain the relationship between field 1 and 2. I am passing field 1 as a parameter in a bash loop.
... (14 Replies)
Hi Forum.
I have the following test.txt file and need to extract certain rows based on "starting position", "length of string" and "string to search for":
1a2b3d
2a3c4d
.....
My script accepts 3 parameters: (starting col pos, length to search for, string to search for) and would like to... (4 Replies)
Hi,
I need to pass the multiple values of src1 to another variable. I managed to print it but not sure how to assign it to a variable in a loop.
src1=01,02,03
echo $src1|awk 'BEGIN {FS=","} {for(i=1;i<=NF;i++) print $i}'
I need to pass the value as
src2=01
src2=02
src2=03
Thanks... (4 Replies)
Hi All,
I have a script which intends to create as many variables at runtime, as the number of parameters passed to it. The script needs to save these parameter values in the variables created and print them
abc.sh
----------
export Numbr_Parms=$#
export a=1
while
do
export... (3 Replies)
Discussion started by: dev.devil.1983
3 Replies
LEARN ABOUT OSX
locale::codes::langext
Locale::Codes::LangExt(3pm) Perl Programmers Reference Guide Locale::Codes::LangExt(3pm)NAME
Locale::Codes::LangExt - standard codes for language extension identification
SYNOPSIS
use Locale::Codes::LangExt;
$lext = code2langext('acm'); # $lext gets 'Mesopotamian Arabic'
$code = langext2code('Mesopotamian Arabic'); # $code gets 'acm'
@codes = all_langext_codes();
@names = all_langext_names();
DESCRIPTION
The "Locale::Codes::LangExt" module provides access to standard codes used for identifying language extensions, such as those as defined in
the IANA language registry.
Most of the routines take an optional additional argument which specifies the code set to use. If not specified, the default IANA language
registry codes will be used.
SUPPORTED CODE SETS
There are several different code sets you can use for identifying language extensions. A code set may be specified using either a name, or
a constant that is automatically exported by this module.
For example, the two are equivalent:
$lext = code2langext('acm','alpha');
$lext = code2langext('acm',LOCALE_LANGEXT_ALPHA);
The codesets currently supported are:
alpha
This is the set of three-letter (lowercase) codes from the IANA language registry, such as 'acm' for Mesopotamian Arabic.
This is the default code set.
ROUTINES
code2langext ( CODE [,CODESET] )
langext2code ( NAME [,CODESET] )
langext_code2code ( CODE ,CODESET ,CODESET2 )
all_langext_codes ( [CODESET] )
all_langext_names ( [CODESET] )
Locale::Codes::LangExt::rename_langext ( CODE ,NEW_NAME [,CODESET] )
Locale::Codes::LangExt::add_langext ( CODE ,NAME [,CODESET] )
Locale::Codes::LangExt::delete_langext ( CODE [,CODESET] )
Locale::Codes::LangExt::add_langext_alias ( NAME ,NEW_NAME )
Locale::Codes::LangExt::delete_langext_alias ( NAME )
Locale::Codes::LangExt::rename_langext_code ( CODE ,NEW_CODE [,CODESET] )
Locale::Codes::LangExt::add_langext_code_alias ( CODE ,NEW_CODE [,CODESET] )
Locale::Codes::LangExt::delete_langext_code_alias ( CODE [,CODESET] )
These routines are all documented in the Locale::Codes::API man page.
SEE ALSO
Locale::Codes
The Locale-Codes distribution.
Locale::Codes::API
The list of functions supported by this module.
http://www.iana.org/assignments/language-subtag-registry
The IANA language subtag registry.
AUTHOR
See Locale::Codes for full author history.
Currently maintained by Sullivan Beck (sbeck@cpan.org).
COPYRIGHT
Copyright (c) 2011-2012 Sullivan Beck
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl v5.16.2 2012-10-11 Locale::Codes::LangExt(3pm)