08-27-2010
You could use awk with semi-colon as the field separator. Can't actually write this for you without full info about the data.... I could take guesses... you could post your assignment sheet (betting that this is for school).
10 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
I am new to the unix server.
My question is:
i have 10 users
a
b
c
d
e
f
g
h
i
j
Among the 10 5 users are (normal) user and remainging 5 users are (qad) users
How can i sepearte this one?
How can i give the dlc access rights?
Please provide the clear cut idea. (0 Replies)
Discussion started by: kingganesh04
0 Replies
2. Shell Programming and Scripting
Whats a good way to group (by adding a new integer to the front of each line) pairs of lines, such that lines 1 & 2 are group 1, lines 3 & 4 are group 2, etc...
ex input:
A
B
C
D
etc...
ex output:
1A
1B
2C
2D
etc... (5 Replies)
Discussion started by: watingo
5 Replies
3. Shell Programming and Scripting
Hi,
I am looking for a way to Group the Lines in a file.. Basically My file structure is something like this
A 1 100 abc def
A 1 200 abc def
A 1 300 abc def
A 2 100 pqr def
A 2 200 pqr def
A 2 300 pqr def
A 1 100 abc def
A 1 200 xyz def
A 1 300 xyz def
I need it as... (1 Reply)
Discussion started by: mkandula1983
1 Replies
4. UNIX for Dummies Questions & Answers
Hi,
I am looking for a way to Group the Lines in a file.. Basically My file structure is something like this
A 1 100 abc def
A 1 200 abc def
A 1 300 abc def
A 2 100 pqr def
A 2 200 pqr def
A 2 300 pqr def
A 1 100 abc def
A 1 200 xyz def
A 1 300 xyz def
I need it as... (6 Replies)
Discussion started by: mkandula1983
6 Replies
5. Shell Programming and Scripting
I have a text file in this format.
Group: AAA
Notes: IP : 11.11.11.11
#User xxxxxxxxx
#Password aaaaaaaaaaaaaaaa
Group: AAA
Notes: IP : 11.11.11.22
#User yyyyyyyyyyyyy
#Password bbbbbbbbbbbbb (8 Replies)
Discussion started by: anil510
8 Replies
6. Shell Programming and Scripting
cat book.txt
book1 price 23
sku 1234
auth Bill
book2 sku 1233
price 22
auth John
book3 auth Frank
price 24
book4 price 25
sku 129
auth Tod
import re
f = open('book.txt', 'r')
text = f.read()
f.close()
m =... (2 Replies)
Discussion started by: chirish
2 Replies
7. Shell Programming and Scripting
Hi all,
I am using following command:
perl program.pl input.txt output.txt CUTOFF 3 > groups_3.txt
containing program.pl, two files (input.txt, output.txt) and getting output in groups_3.txt:
But, I wish to have 30 files corresponding to each CUTOFF ranging from 0 to 30 using the same... (1 Reply)
Discussion started by: bioinfo
1 Replies
8. Shell Programming and Scripting
awk 'FNR==NR {a; next} $NF in a' genes.txt refseq_exons.txt > output.txt
I can not figure out how to group the same name in $4 together.
Basically, all the SKI together in separate rows and all the TGFB2. Thank you :).
chr1 2160133 2161174 SKI
chr1 218518675 218520389 TGFB2... (1 Reply)
Discussion started by: cmccabe
1 Replies
9. Shell Programming and Scripting
Hello,
I would like to group/sort a file of records by a particular field and then count how many records belong in that grouping.
For example say I have the following data:
1234|"ZZZ"|"Date"|"1"|"Y"|"ABC"|""|AA
ABCD|"ZZZ"|"Date"|"1"|"Y"|"ABC"|""|AA
EFGH|"ZZZ"|"Date"|"1"|"Y"|"ABC"|""|BB... (14 Replies)
Discussion started by: Nik44
14 Replies
10. Shell Programming and Scripting
Hi can you please help with the below ?
source file:
Column1,Column2,Column3,Column4
abc,123,dir1/FXX/F19,1
abc,123,dir1/FXX/F20,1
abc,123,dir1/FXX/F23,2
abc,123,dir1/FXX/C25,2
abc,123,dir1/FXX/X25,2
abc,123,dir1/FXX/A23,3
abc,123,dir1/FXX/Z25,3
abc,123,dir1/FXX/Y25,4
I want to... (3 Replies)
Discussion started by: paul1234
3 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 Database
SYNOPSIS
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)