Enhance existing script: Extract Multiple variables & Input in an echo string
Hi Experts
I need your help to optimize my script to execute better as I have nearly 1M records & the script is taking close to 40 minutes to execute, so would need support on a faster alternative.
Input: file
Script:
Output:
Thanks for your help in advance
Regards
Nk
I have a variable which consists of a string like this:
001 aaabc 44 a bbb12
How do I extract each substring, delimited by the spaces, into new variables - one for each substring?
eg var1 will be 001, var2 will be aaabc, var3 will be 44, var4 will be a, etc?
I've come up with this:... (2 Replies)
Hi All,
Is it possible in Unix shell script to extract numbers from a string containing ".", such as;
5.2.314
And store in variables so;
var1 = 5
var2 = 2
var3 = 314
Thanks in advance for any help anyone can provide
dave (6 Replies)
find . -type f -name "*.sql" -print|xargs perl -i -pe 's/pattern/replaced/g'
this is simple logic to find and replace in multiple files & folders
Hope this helps.
Thanks
Zaheer (0 Replies)
Guys,
I do have a script that runs to take the server out from network, after running the script it is writing the new log file{outFile} in to directory . Now what i need is my script should tail the last modified file{outFile} & search the string {Server Status} ans should echo the same at the... (0 Replies)
I would like to extract directories from a specific place and keep them into an array of variables to run functions into it. Example,
bash-3.00$ls
adrian bryan caren derrick
I want to keep each directory names into a variable
adrian --> document
bryan --> document
caren --> document... (3 Replies)
Hi all.
I have the following command that is successfully searching for any one of the strings on all lines of a file and replacing it with the instructed value.
cat inputFile | awk '{gsub(/aaa|bbb|ccc|ddd/,"1234")}1' > outputFile
This does in fact replace any occurrence of aaa, bbb,... (2 Replies)
Hey guys. I know pratically 0 about Linux, so could anyone please give me instructions on how to accomplish this ?
The distro is RedHat 4.1.2 and i need to find and replace a multiple lines string in several php files across subdirectories.
So lets say im at root/dir1/dir2/ , when i execute... (12 Replies)
Hi,
I have long string in 2nd field, as shown below:
REF1 | CLESCLJSCSHSCSMSCSNSCSRSCUDSCUFSCU7SCV1SCWPSCXGPDBACAPA0DHDPDMESED6
REF2 | SBR4PCBFPCDRSCSCG3SCHEBSCKNSCKPSCLLSCMCZXTNPCVFPCV6P4KL0DMDSDSASEWG
I have a group of fixed patterns which can occur in these long strings & only... (11 Replies)
I've got a file that looks like this (spaces before first entries intentional):
12345650-000005000GL140227 ANNUAL HELC FEE EN
22345650-000005000GL140227 ANNUAL HELC FEE EN
32345650-000005000GL140227 ANNUAL HELC FEE EN
I want to read through the file line by line,... (6 Replies)
Here is my input
# MANIFEST.MF
Manifest-Version: 1.0
Build-Jdk: 1.6.0
Built-By: CM_TEAM
Build_SvnRev: 662789
Build_Number: 13.0.0.0-JDK8
Build_Date: Wed 04/05/2017-20:48:19.17
Archiver-Version: Plexus Archiver
Created-By: Apache Maven 3.1.0
Here is the expected output:... (4 Replies)
Discussion started by: kchinnam
4 Replies
LEARN ABOUT PHP
geoip_record_by_name
GEOIP_RECORD_BY_NAME(3) 1 GEOIP_RECORD_BY_NAME(3)geoip_record_by_name - Returns the detailed City information found in the GeoIP DatabaseSYNOPSIS
array geoip_record_by_name (string $hostname)
DESCRIPTION
The geoip_record_by_name(3) function will return the record information corresponding to a hostname or an IP address.
This function is available for both GeoLite City Edition and commercial GeoIP City Edition. A warning will be issued if the proper data-
base cannot be located.
The names of the different keys of the returning associative array are as follows:
o "continent_code" -- Two letter continent code (as of version 1.0.4 with libgeoip 1.4.3 or newer)
o "country_code" -- Two letter country code (see geoip_country_code_by_name(3))
o "country_code3" -- Three letter country code (see geoip_country_code3_by_name(3))
o "country_name" -- The country name (see geoip_country_name_by_name(3))
o "region" -- The region code (ex: CA for California)
o "city" -- The city.
o "postal_code" -- The Postal Code, FSA or Zip Code.
o "latitude" -- The Latitude as signed double.
o "longitude" -- The Longitude as signed double.
o "dma_code" -- Designated Market Area code (USA and Canada only)
o "area_code" -- The PSTN area code (ex: 212)
PARAMETERS
o $hostname
- The hostname or IP address whose record is to be looked-up.
RETURN VALUES
Returns the associative array on success, or FALSE if the address cannot be found in the database.
CHANGELOG
+--------+---------------------------------------------------+
|Version | |
| | |
| | Description |
| | |
+--------+---------------------------------------------------+
| 1.0.4 | |
| | |
| | Adding the continent_code with GeoIP Library |
| | 1.4.3 or newer only |
| | |
| 1.0.3 | |
| | |
| | Adding country_code3 and country_name |
| | |
+--------+---------------------------------------------------+
EXAMPLES
Example #1
A geoip_record_by_name(3) example
This will print the array containing the record of host example.com.
<?php
$record = geoip_record_by_name('www.example.com');
if ($record) {
print_r($record);
}
?>
The above example will output:
Array
(
[continent_code] => NA
[country_code] => US
[country_code3] => USA
[country_name] => United States
[region] => CA
[city] => Marina Del Rey
[postal_code] =>
[latitude] => 33.9776992798
[longitude] => -118.435096741
[dma_code] => 803
[area_code] => 310
)
PHP Documentation Group GEOIP_RECORD_BY_NAME(3)