Hi
I have the following file that i need to run a sed command on
1<tab>running
2<tab>running
3<tab>running
4<tab>running
I want to be able to replace a line i.e the second one with '2<tab>failed'. As the first number is unique that can be used to search for the relevant line (using ^2 i... (5 Replies)
Hi group,
I want to replace the occurance of a particular text in a paragraph.I tried with Sed,but Sed only displays the result on the screen.How can i update the changes in the original file???
The solution should be a one liner using awk and sed.
Thanks in advance. (5 Replies)
Hi
I am struggling to find a solutions to this problem:
I have a directory full of files and I wish to:
read each line of each file and
if any one line in those files is longer than 72 characters I want to replace any tab characters with a space character.
Ive been... (3 Replies)
This seems like it should be an easy problem, but I'm a noob and I can't figure it out. I'm trying to use sed, but would be happy to use anything that does the job.
I am trying to trim off a fixed number of unknown characters from 2 different : delimited fields while keeping the intervening... (4 Replies)
Hi,
i have a file with lines,
file.txt
-------
test is fun
testing is better
I need to replace 'test' to 'develop' and i used,
a=test
b=develop
sed "s,$a,$b,g" -------- but i see the word 'testing' is also replaced. Need some solution. Is there any way i could replace only 'test' ? (4 Replies)
How would I print out the total amount through awk? I tried using
print "Total Amount: " $4+$4;
Would I have to do a for loop to get through everything? (2 Replies)
I have a column of numbers $2, I would like to add 360 to all numbers that are negative. This method seems a bit convoluted, and does not work (outputs 0):
BEGIN {
A=sprintf("%d", $2);
if(A<0) A=A+360;
BIN++;
}
END { for(A in BIN) print... (5 Replies)
Hi guys,
I worked for almost a half-day for the replacement of some text automatically with script. But no success.
The problem is I have hundred of files, which need to be replaced with some new text. It's a painful work to work manually and it's so easy to do it wrong.
For example,
I... (2 Replies)
input
"A","B","C,D","E","F"
"S","T","U,V","W","X"
"AA","BB","CC,DD","EEEE","FFF"
required output:
"A","B","C,D","C,D","F"
"S", T","U,V","U,V","X"
"AA","BB","CC,DD","CC,DD","FFF"
tried using awk but double quotes not preserving for every field. any help to solve this is much... (5 Replies)
Hi all,
Saying we have two files:
1. A "Reference File" whose content is "Variable Name": "Variable Value"
2. A "Model File" whose content is a model program in which I want to substitute "VariableName" with their respective value to produce a third file "Program File" which would be a... (4 Replies)
Discussion started by: dae
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)