gawk asort to sort record groups based on one subfield
input ("/" delimited fields):
Records with same field 1 belong to the same group.
Using asort (not sort), in each group I need to sort the records in ascending order based on the string between braces in field 2, to obtain:
I tried to sort the records by field1 and then by subfield2 in field2, but it didn't work:
I am using a solution that was provided by a member:
awk '{s=$0;if(length(s) < 700){getline; s=s " " $0}printf("%s\n",s)}'
This scans through a file and removes '\n' within a record but not the record delimiter.
However, there are instances where there are MULTIPLE instances of '\n'... (10 Replies)
Hi Guys,
After windows died on my netbook I installed Lubuntu and discovered Gawk about a month ago. After using Excel for 10+ years I'm amazed how quick and easily Gawk can process data but I'm stuck with a little problem merging data from multiple lines.
I'm an SEO Consultant and provide... (9 Replies)
Input_file_1
#content_1
A
#content_2
AF
#content_3
AAR
#content_4
ASEI
#content_5
AS
#content_6
ADFSFGS
Rules:
1. Based on c program to calculate content of each "#". Result getting from the above Input_file_1 are 1,2,3,4,2,7;
2. Sort length on reverse order (descending order).... (5 Replies)
I've been searching high and low for this...but, maybe I'm just missing something. I have a file to be sorted that, unfortunately, contains binary data at the end of the line. As you may guess, this binary data may contain a newline character, which messes up the sort. I think I could resolve this... (5 Replies)
Hi everyone,
I've really searched for a solution to this and this is what I found so far:
I need to sort a command output (here represented as a "cat file" command) and from the second down to the second-last line based on the second row and then print ALL the output with the specified section... (7 Replies)
Hello,
I have the following script :
BEGIN {
print "1 ***";
split("abc",T,"");
T="e";
T="z";
T="y";
for (i in T) printf("%i:%s ",i,T); print "";
for (i=1; i<=length(T); i++) printf(T); print ""
print "2 ***";
asort(T,U);
for (i in U) printf("%i:%s ",i,U); ... (3 Replies)
Hi
I'd like to extract from a text file, using gawk, the groups of words beginning with a capital letter, that are not at the begining of a sentence (i.e. Not after a full stop and a pace ". "), including special characters like registered or trademark (® or ™ ).
For example I would like to... (1 Reply)
Output from zipdiff GNU EAR comparison tool produces output in html divided into three sections "Added, Removed, Changed". I want the output to be sorted by jar or war file.
<html>
<body>
<table>
<tr>
<td class="diffs" colspan="2">Added </td>
</tr>
<tr><td>
<ul>... (5 Replies)
Hi,
PROCINFO seems to be a great function but I don't manage to make it works.
input:
B,A,C
B
B,B
As an example, just want to count the occurence of each letter across the input and sort them by decreased order.
Wanted output:
B 4
A 1
C 1
When I use this command, the PROCINFO... (4 Replies)
Hi, I have some data I have taken from the internet in the following scheme:
name
direction
webpage
phone number
open hours
menu url
book url
name
...
Of course the only line that is mandatory is the name wich is the one I want to sort by.
I have the following sed & awk script that... (3 Replies)
Discussion started by: devmsv
3 Replies
LEARN ABOUT DEBIAN
geo::googleearth::pluggable::plugin::style
Geo::GoogleEarth::Pluggable::Plugin::Style(3pm) User Contributed Perl Documentation Geo::GoogleEarth::Pluggable::Plugin::Style(3pm)NAME
Geo::GoogleEarth::Pluggable::Plugin::Style - Geo::GoogleEarth::Pluggable Style Plugin Methods
SYNOPSIS
use Geo::GoogleEarth::Pluggable;
my $document=Geo::GoogleEarth::Pluggable->new; #ISA L<Geo::GoogleEarth::Pluggable>
my $style=$document->IconStyle(color=>{red=>255}); #ISA L<Geo::GoogleEarth::Pluggable::Style>
my $point=$document->Point(style=>$style); #ISA L<Geo::GoogleEarth::Pluggable::Contrib::Point>
print $document->render;
METHODS
Methods in this package are AUTOLOADed into the Geo::GoogleEarth::Pluggable::Folder namespace at runtime.
Style
Constructs a new Style object and appends it to the document object. Returns the Style object reference.
my $style=$folder->Style(
id => $id, #default is good
IconStyle => {},
LineStyle => {},
PolyStyle => {},
LabelStyle => {},
ListStyle => {},
);
my $style=$folder->Style(
IconStyle => $style1, #extracts IconStyle from $style1
LineStyle => $style2, #extracts LineStyle from $style2
PolyStyle => $style3, #extracts PolyStyle from $style3
);
StyleMap
Constructs a new StyleMap object and appends it to the document object. Returns the StyleMap object reference.
my $stylemap=$document->StyleMap(
normal => $style1,
highlight => $style2,
);
IconStyle
my $style=$folder->IconStyle(
color => $color,
scale => $scale,
href => $url,
);
LineStyle
my $color={red=>255, green=>255, blue=>255, alpha=>255};
my $style=$folder->LineStyle(color=>$color);
PolyStyle
my $color={red=>255, green=>255, blue=>255, alpha=>255};
my $style=$folder->PolyStyle(color=>$color);
LabelStyle
my $style=$folder->LabelStyle(
color => $color,
scale => $scale,
);
ListStyle
my $style=$folder->ListStyle(
href => $url,
);
TODO
Need to determine what methods should be in the Folder package and what should be on the Plugin/Style package and why.
BUGS
Please log on RT and send to the geo-perl email list.
LIMITATIONS
This will construct 100 identical style objects
foreach (1 .. 100) {
$document->Point(style=>$document->IconStyle(color=>{red=>255}));
}
Do this instead
my $style=$document->IconStyle(color=>{red=>255});
foreach (1 .. 100) {
$document->Point(style=>$style);
}
SUPPORT
Try geo-perl email list.
AUTHOR
Michael R. Davis (mrdvt92)
CPAN ID: MRDVT
COPYRIGHT
This program is free software licensed under the...
The BSD License
The full text of the license can be found in the LICENSE file included with this module.
SEE ALSO
Geo::GoogleEarth::Pluggable creates a GoogleEarth Document.
perl v5.14.2 2011-06-25 Geo::GoogleEarth::Pluggable::Plugin::Style(3pm)