Sponsored Content
Top Forums Shell Programming and Scripting How to build a string in shell script Post 302215539 by Franklin52 on Wednesday 16th of July 2008 03:52:16 PM
Old 07-16-2008
One way:

Code:
echo 'PK="PK1 PK2 PK3"' |
awk -F"\"" '{split($2,s," ")
print "a."s[1]"=b."s[1]" and a."s[2] "=b."s[2] " and a."s[3] "=b."s[3]}'

Regards
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

question to build a shell script

Hi All, I want to develope a script. can you please give me solution to this script? Several Processes Reporting Status back to a Master Write two programs that communicate using message queues. One program (the master) will receive messages periodically sent by multiple copies of the... (5 Replies)
Discussion started by: vishalpatel03
5 Replies

2. Shell Programming and Scripting

String compare in shell script

Iam trying to compare the string in if else... but some how its not working following is the code On executing the above one its giving a error message ': bad number' in the above parameter l & k are numbers and dbfiles and patchefiles are array If i do echo ift working fine ... (2 Replies)
Discussion started by: kiranlalka
2 Replies

3. Shell Programming and Scripting

how to build a pipe delimited string

#! /bin/csh set delimiter = | foreach i (*) set str_deli="$i$delimiter" question: how to retain the value of str_deli so i can build a pipe delimited string? end (1 Reply)
Discussion started by: jdsignature88
1 Replies

4. Shell Programming and Scripting

Need to build Shell Script to search content of a text file into a folder consist several files

Have to read one file say sourcefile containing several words and having another folder containing several files. Now read the first word of Sourcefile & search it into the folder consisting sevral files, and create another file with result. We hhave to pick the filename of the file in which... (3 Replies)
Discussion started by: mukesh.baranwal
3 Replies

5. Shell Programming and Scripting

TRIM a string in shell script

HI, I have a string "NZ-deploy-mode-1.15-Linux.x86_64.rpm" I want to get the string before -1 ie "NZ-deploy-mode" Input is "NZ-deploy-mode-1.15-Linux.x86_64.rpm" expected output is "NZ-deploy-mode" How can I do that in shell script? Thanks in advance. (6 Replies)
Discussion started by: Ananthdoss
6 Replies

6. Shell Programming and Scripting

build a string of asterisks elegantly

hi in a script i hate string definitions like str="***********************************" who can help to build a 50 character long string of asterisks more elegantly? any hint is welcome thanks and regards lazy (18 Replies)
Discussion started by: lazybaer
18 Replies

7. UNIX for Dummies Questions & Answers

Comparing a String variable with a string literal in a Debian shell script

Hi All, I am trying to to compare a string variable with a string literal inside a loop but keep getting the ./testifstructure.sh: line 6: #!/bin/sh BOOK_LIST="BOOK1 BOOK2" for BOOK in ${BOOK_LIST} do if then echo '1' else echo '2' fi done Please use next... (1 Reply)
Discussion started by: daveu7
1 Replies

8. Shell Programming and Scripting

How to get the last value from a string in shell script?

I have to get the last value from a string, below is the example string String -> Here is the test string 12233 O/P -> 12233 String -> Hello world 500 O/P -> 500 String -> 300 O/P -> 300 Please help (2 Replies)
Discussion started by: vel4ever
2 Replies

9. Shell Programming and Scripting

Shell script to build directory tree and files

Hi all, I'm trying at the moment to write a shell script to build a directory tree and create files within the built directories. I've scoured through sites and text books and I just can't figure out how to go about it. I would assume that I need to use loops of some sort, but I can't seem... (8 Replies)
Discussion started by: Libertad
8 Replies

10. Shell Programming and Scripting

Build.xml invocation by Build Script

Hi I have a build.xml file and I can run it on Windows via cmd. Now I want to write a script to invoke the same. Is there a way to do this? (1 Reply)
Discussion started by: ankur328
1 Replies
GEOIP_REGION_NAME_BY_CODE(3)						 1					      GEOIP_REGION_NAME_BY_CODE(3)

geoip_region_name_by_code - Returns the region name for some country and region code combo

SYNOPSIS
string geoip_region_name_by_code (string $country_code, string $region_code) DESCRIPTION
The geoip_region_name_by_code(3) function will return the region name 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 region name on success, or FALSE if the country and region code combo cannot be found. EXAMPLES
Example #1 A geoip_region_name_by_code(3) example using region code for US/Canada This will print the region name for country CA (Canada), region QC (Quebec). <?php $region = geoip_region_name_by_code('CA', 'QC'); if ($region) { echo 'Region name for CA/QC is: ' . $region; } ?> The above example will output: Region name for CA/QC is: Quebec Example #2 A geoip_region_name_by_code(3) example using FIPS codes This will print the region name for country JP (Japan), region 01. <?php $region = geoip_region_name_by_code('JP', '01'); if ($region) { echo 'Region name for JP/01 is: ' . $region; } ?> The above example will output: Region name for JP/01 is: Aichi PHP Documentation Group GEOIP_REGION_NAME_BY_CODE(3)
All times are GMT -4. The time now is 08:51 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy