Hi, awk seem to be acting differently in Unix and Linux when it comes to formatting. This is making it difficult to migrate scripts.
for example:
UNIX:
in Linux:
Could anyone help me understand why such a difference? And how can I tell awk to treat everything as string and pad with zeros at the beginning in Linux?
Thank you in advance..
---------- Post updated at 12:30 PM ---------- Previous update was at 12:20 PM ----------
Just found the awk in Linux is pointing to gawk. Could that be the reason?
Hi ,
I have a piece of code ...wherein I need to assign the following ...
1) A command line argument to a variable
e.g origCount=ARGV
2) A unix command to a variable
e.g result=`wc -l testFile.txt`
in my awk shell script
When I do this :
print "origCount" origCount --> I get the... (0 Replies)
Hello everybody,
I am having problem in converting byte array variables to Hexa String variables for Linux. I have done, converting byte array variables to Hexa String variables for Windows but same function doesn't work for linux. Is there any difference in OS ? The code for Windows is given... (2 Replies)
I have a simple csh-script on a Solaris Workstaion which invokes the bc calculator:
#!/bin/csh
set shz=2
set zshift=5
set shzp=`bc -l <<END \
scale = 3 \
-1. * $shz + $zshift \
END`
echo $shzp
The result ($shzp) in this case is 3 (-1*2+5). It works fine on Solaris 8.
... (2 Replies)
Hi,
I have an awk script which performs simple operations of variable assignments and finally printing the variables in custom form.
BEGIN {FS=OFS="\n"}
{
v1=substr($0,1,15)
v2=substr($0,16,200)
v3=substr($0,216,20)
print v1 "|" v2 "|" v3
}
The input file being processed... (2 Replies)
Hi All
The below is the script, if i supply the script with the argument -f then it will delete the tmp file . We are having 3 unix system out of that two system are processing this file only one system is not processing and the error showin is below the script ..
can you please help me
... (2 Replies)
Hi all,
For no particular reason, I would like to use awk on a file that contains multiple columns, but let's say only columns 1 and 2 have some text values, and the remainder of the line contains text that I would like to treat as one column, considering I have spaces as delimiter for the... (33 Replies)
Hi Gurus,
I hit a hard block in my script.
when using awk command with variable, I got different result.
Please see below:
my test file as below:
$ cat demofile.txt
filename-yyyy-abcd
filename-xxx-week-pass
filename-xxx-week-run
for testing purpose, I put 3 awk command in one script.... (7 Replies)
Greetings Experts,
We are migrating from AIX to RHEL Linux. I have created a script to verify and report the NULLs and SPACEs in the key columns and duplicates on key combination of "|" delimited set of big files. Following is the code that was successfully running in AIX.
awk -F "|" 'BEGIN {... (5 Replies)
Discussion started by: chill3chee
5 Replies
LEARN ABOUT PHP
msgfmt_get_pattern
MSGFMT_GET_PATTERN(3) 1 MSGFMT_GET_PATTERN(3)MessageFormatter::getPattern - Get the pattern used by the formatter
Object oriented style
SYNOPSIS
public string MessageFormatter::getPattern (void )
DESCRIPTION
Procedural style
string msgfmt_get_pattern (MessageFormatter $fmt)
Get the pattern used by the formatter
PARAMETERS
o $fmt
- The message formatter
RETURN VALUES
The pattern string for this message formatter
EXAMPLES
Example #1
msgfmt_get_pattern(3) example
<?php
$fmt = msgfmt_create( "en_US", "{0, number} monkeys on {1, number} trees" );
echo "Default pattern: '" . msgfmt_get_pattern( $fmt ) . "'
";
echo "Formatting result: " . msgfmt_format( $fmt, array(123, 456) ) . "
";
msgfmt_set_pattern( $fmt, "{0, number} trees hosting {1, number} monkeys" );
echo "New pattern: '" . msgfmt_get_pattern( $fmt ) . "'
";
echo "Formatted number: " . msgfmt_format( $fmt, array(123, 456) ) . "
";
?>
Example #2
OO example
<?php
$fmt = new MessageFormatter( "en_US", "{0, number} monkeys on {1, number} trees" );
echo "Default pattern: '" . $fmt->getPattern() . "'
";
echo "Formatting result: " . $fmt->format(array(123, 456)) . "
";
$fmt->setPattern("{0, number} trees hosting {1, number} monkeys" );
echo "New pattern: '" . $fmt->getPattern() . "'
";
echo "Formatted number: " . $fmt->format(array(123, 456)) . "
";
?>
The above example will output:
Default pattern: '{0,number} monkeys on {1,number} trees'
Formatting result: 123 monkeys on 456 trees
New pattern: '{0,number} trees hosting {1,number} monkeys'
Formatted number: 123 trees hosting 456 monkeys
SEE ALSO msgfmt_create(3), msgfmt_set_pattern(3).
PHP Documentation Group MSGFMT_GET_PATTERN(3)