On Fri, Nov 27, 2015 at 09:57:11AM -0700, jd1008 wrote:
>
>
> On 11/27/2015 03:29 AM, Andrew Haley wrote:
> >#!/bin/awk -f
> >{
> > lines[NR]=$NF " " $0
> >}
> >
> >END {
> > PROCINFO["sorted_in"]="@val_type_asc"
> ># for (i in lines) {
for (i = NR; i >= 1; i--) {
> >
On 11/27/2015 12:14 PM, Jon LaBadie wrote:
On Fri, Nov 27, 2015 at 09:57:11AM -0700, jd1008 wrote:
On 11/27/2015 03:29 AM, Andrew Haley wrote:
#!/bin/awk -f
{
lines[NR]=$NF " " $0
}
END {
PROCINFO["sorted_in"]="@val_type_asc"
# for (i in lines) {
for (i = NR; i
On 11/27/2015 03:29 AM, Andrew Haley wrote:
#!/bin/awk -f
{
lines[NR]=$NF " " $0
}
END {
PROCINFO["sorted_in"]="@val_type_asc"
for (i in lines) {
line = lines[i]
j=index(line, " ")
print substr(line, j+1)
}
}
Hi Andrew,
manpage for awk
On 11/27/2015 01:28 PM, Jon LaBadie wrote:
On Fri, Nov 27, 2015 at 12:38:38PM -0700, jd1008 wrote:
On 11/27/2015 12:14 PM, Jon LaBadie wrote:
On Fri, Nov 27, 2015 at 09:57:11AM -0700, jd1008 wrote:
On 11/27/2015 03:29 AM, Andrew Haley wrote:
#!/bin/awk -f
{
lines[NR]=$NF " " $0
}
On Fri, Nov 27, 2015 at 12:38:38PM -0700, jd1008 wrote:
>
>
> On 11/27/2015 12:14 PM, Jon LaBadie wrote:
> >On Fri, Nov 27, 2015 at 09:57:11AM -0700, jd1008 wrote:
> >>
> >>On 11/27/2015 03:29 AM, Andrew Haley wrote:
> >>>#!/bin/awk -f
> >>>{
> >>> lines[NR]=$NF " " $0
> >>>}
> >>>
> >>>END
On 13/11/15 02:38, Michael Hennebry wrote:
> Awk can do what you want:
> {
> lines[NR]=$NF " " $0
> }
>
> END {
> PROCINFO["sorted_in"]="@val_type_asc"
> for line in lines {
> j=index(line, " ")
> print substr(line, j+1)
> }
Close, but no cigar.
#!/bin/awk -f
{
On 11/12/2015 07:38 PM, Michael Hennebry wrote:
Awk can do what you want:
{
lines[NR]=$NF " " $0
}
END {
PROCINFO["sorted_in"]="@val_type_asc"
for line in lines {
j=index(line, " ")
print substr(line, j+1)
}
Sorry, but, since this is being archived,
could you
On 11/13/2015 12:32 PM, Ian Malone wrote:
No missing quotes. It's an awk program, not a bash one, $0 is a bash
variable. The only syntax errors I see are no brackets around the for
statement and missing closing brace. My awk here is too old to support
PROCINFO["sorted_in"], so here's a slight
On 11/13/2015 01:32 PM, Robert Nichols wrote:
Try it again with more than 10 lines in the input. That asort()
will be doing a _string_ sort, so with 120 input lines the order
will be 1, 10, 100, 101, 102, ... 109, 11, 110, 111, 112, ... 119,
12, 120, 13, 14, ... 19, 2, 20, 21, ... .
Sorry,
On 13 November 2015 at 16:54, jd1008 wrote:
>
>
> On 11/12/2015 07:38 PM, Michael Hennebry wrote:
>>
>> Awk can do what you want:
>> {
>> lines[NR]=$NF " " $0
>> }
>>
>> END {
>> PROCINFO["sorted_in"]="@val_type_asc"
>> for line in lines {
>> j=index(line, "
On 13 November 2015 at 18:32, Ian Malone wrote:
> On 13 November 2015 at 16:54, jd1008 wrote:
>>
>>
>> On 11/12/2015 07:38 PM, Michael Hennebry wrote:
>>>
>>> Awk can do what you want:
>>> {
>>> lines[NR]=$NF " " $0
>>> }
>
> No missing quotes. It's an
On Fri, 2015-11-13 at 09:54 -0700, jd1008 wrote:
> I assume $0 is the name of the file ??
RTFM, awk(1) in this case. $0 refers to the whole input record (i.e.
the current line), which is why fields are numbered from 1.
I haven't looked at the rest of the script.
poc
--
users mailing list
Awk can do what you want:
{
lines[NR]=$NF " " $0
}
END {
PROCINFO["sorted_in"]="@val_type_asc"
for line in lines {
j=index(line, " ")
print substr(line, j+1)
}
--
Michael henne...@web.cs.ndsu.nodak.edu
"Sorry but your password must contain an uppercase letter, a
On Wed, 2015-11-11 at 15:23 -0600, Bruno Wolff III wrote:
> >How can one tell sort to chose the last word in the line as the sort
> key?
>
> You can't. Field specifiers are relative to the start of the line.
> There
> isn't a way to specify them relative to the end of the line.
In awk NF is the
On 11/11/2015 04:44 PM, Patrick O'Callaghan wrote:
On Wed, 2015-11-11 at 15:23 -0600, Bruno Wolff III wrote:
How can one tell sort to chose the last word in the line as the sort
key?
You can't. Field specifiers are relative to the start of the line.
There
isn't a way to specify them
On Wed, 2015-11-11 at 16:58 -0700, jd1008 wrote:
>
> On 11/11/2015 04:44 PM, Patrick O'Callaghan wrote:
> > On Wed, 2015-11-11 at 15:23 -0600, Bruno Wolff III wrote:
> > > > How can one tell sort to chose the last word in the line as the
> > > > sort
> > > key?
> > >
> > > You can't. Field
: Bruno Wolff III <br...@wolff.to>
To: jd1008 <jd1...@gmail.com>
Cc: Fedora Community Users Support <users@lists.fedoraproject.org>
Sent: Wednesday, November 11, 2015 4:23 PM
Subject: Re: An interesting sort problem
On Wed, Nov 11, 2015 at 13:54:50 -0700,
jd1008 <jd
On Wed, Nov 11, 2015 at 13:54:50 -0700,
jd1008 wrote:
The sort command does not provide for a way to say that the key is the
last word in a line,
where the file contains lines of varying number of words,
and where words are groups of characters without spaces or tabs.
Thus
The sort command does not provide for a way to say that the key is the
last word in a line,
where the file contains lines of varying number of words,
and where words are groups of characters without spaces or tabs.
Thus
sort -k
How can one tell sort to chose the last word in the line
19 matches
Mail list logo