10-11-2013
Thanks!
But how do I find 3 digits before 10 digits from right ? Number could be greater or less than 10... if greater it might have leading multiple zeros.. So need to compare from the right side of the string.
eg: number 1231234567890
country (123)1234567890
eg: number 00000000121234567890
country 012
eg number 12345
country : nothing will be there to compare as number is not 10 digit
Please help !
Last edited by vegasluxor; 10-11-2013 at 09:05 AM..
9 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I'm executing "wc -lc" command in a c shell script to get record count and byte counts and writing them to a file. I get the result with the full pathname of the file. But I do not want the path name to be printed in the output file. I heard that using Awk we can get this but I don't have any... (4 Replies)
Discussion started by: stakuri
4 Replies
2. Shell Programming and Scripting
Hi,
Im an awk noob and I am having trouble trying to get matches.
Here is my script:
#!/bin/gawk -f
BEGIN {}
$0 ~ /<a href=".*">.*<\/a>/{print}
Ideally I want to be able to get the actual link and print it. In PHP you can do preg_replace and get the match you want by using \\1 where 1... (2 Replies)
Discussion started by: adsyuk
2 Replies
3. Shell Programming and Scripting
HI,
Need awk command to get date and time alone from
Input : "15:29:15 28.08.2010|SCHEDULE: Started program POSG1"
Output expected : "15:29:15 28.08.2010"
Please help. (9 Replies)
Discussion started by: shanneykar
9 Replies
4. Shell Programming and Scripting
Hi,
I have a program written in awk and I want to extend it to do another task.
My program is a list of CVS log reports of a repository. For each file, I have some fields. One of the fields is the comment field. I want to know how I can check if a comment (which is a free text field)... (8 Replies)
Discussion started by: sandeepk1611
8 Replies
5. Shell Programming and Scripting
I have the following simplified code that I am planning on putting into a larger shell script. I have been butchering it to try and make work amongst google searches and reading awk documentation.
amixer sset Master toggle | awk '{ if ( /^ Front Left/ { print $7 } == // ) print "MUTED" }'I... (2 Replies)
Discussion started by: jelloir
2 Replies
6. Shell Programming and Scripting
Hello,
I have a bunch of strings of the following format:
11.22.33.44.in-addr.arpa x.y.z.
What I want to do is format each string in this way:
44.33.22.11 x.y.z
i.e. the string conists of two columns, where delimiter is space. I need to output modified first column (delimiter inside... (7 Replies)
Discussion started by: zerorange
7 Replies
7. Shell Programming and Scripting
Hi all,
I was doing some string manipulation in my script and wanted to try using awk. However, I have been stuck with string compare. A simplified form of my conundrum is given below:
The below prints expected result (prints "Completed because that is the second element"):
$ echo... (5 Replies)
Discussion started by: faraway
5 Replies
8. Shell Programming and Scripting
Hi All,
I have a file test.txt.
Content of test.txt :
1 vinay se
2 kumar sse
4 kishore tl
I am extracting the content of file with below command.
awk '$2 ~ "vinay" {print $0}' test.txt
Now instead of hardcoding $2 is there any way pass $2 as variable and compare with a... (7 Replies)
Discussion started by: Girish19
7 Replies
9. UNIX for Beginners Questions & Answers
I have below code inside my awk script
if ( $0 ~ /SVC IN:/ )
{
svc_in=substr( $0,23 , 3);
if (msg_start == 1 && msg_end == 0)
{
msg_arr=$0;
}
}
else if ( $0 ~ /^SVC OUT:/ )
{
svc_out=substr( $0, 9, 3);
if (msg_start == 1 && msg_end == 0)
... (6 Replies)
Discussion started by: bhagya123
6 Replies
LEARN ABOUT PHP
geoip_time_zone_by_country_and_region
GEOIP_TIME_ZONE_BY_COUNTRY_AND_REGION(3) 1 GEOIP_TIME_ZONE_BY_COUNTRY_AND_REGION(3)
geoip_time_zone_by_country_and_region - Returns the time zone for some country and region code combo
SYNOPSIS
string geoip_time_zone_by_country_and_region (string $country_code, [string $region_code])
DESCRIPTION
The geoip_time_zone_by_country_and_region(3) function will return the time zone corresponding to a country and region code combo.
In the United States, the region code corresponds to the two-letter abbreviation of each state. In Canada, the region code corresponds to
the two-letter province or territory code as attributed by Canada Post.
For the rest of the world, GeoIP uses FIPS 10-4 codes to represent regions. You can check http://www.maxmind.com/app/fips10_4 for a
detailed list of FIPS 10-4 codes.
This function is always available if using GeoIP Library version 1.4.1 or newer. The data is taken directly from the GeoIP Library and not
from any database.
PARAMETERS
o $country_code
- The two-letter country code (see geoip_country_code_by_name(3))
o $region_code
- The two-letter (or digit) region code (see geoip_region_by_name(3))
RETURN VALUES
Returns the time zone on success, or FALSE if the country and region code combo cannot be found.
EXAMPLES
Example #1
A geoip_time_zone_by_country_and_region(3) example using region code for US/Canada
This will print the time zone for country CA (Canada), region QC (Quebec).
<?php
$timezone = geoip_time_zone_by_country_and_region('CA', 'QC');
if ($timezone) {
echo 'Time zone for CA/QC is: ' . $timezone;
}
?>
The above example will output:
Time zone for CA/QC is: America/Montreal
Example #2
A geoip_time_zone_by_country_and_region(3) example using FIPS codes
This will print the time zone for country JP (Japan), region 01 (Aichi).
<?php
$timezone = geoip_time_zone_by_country_and_region('JP', '01');
if ($timezone) {
echo 'Time zone for JP/01 is: ' . $timezone;
}
?>
The above example will output:
Time zone for JP/01 is: Asia/Tokyo
PHP Documentation Group GEOIP_TIME_ZONE_BY_COUNTRY_AND_REGION(3)