I've tried the binaries in /usr/xpg4/bin/ and I don't think it makes a difference. I still cannot sort this list. The only way I can sort the list is if use "s" as a delimiter. "/" does not seem to work at all. I have also tried a Linux system with the same issue. Also, I have tried the following:
I then tried a 2.6n to attempt to use characters in the sorting. I tried what other folks have recommended in their posts but no luck. Anyone have any clues?
So far this is the only command that works:
If I use it I get the list in the desired order:
Otherwise I get:
---------- Post updated at 09:43 AM ---------- Previous update was at 09:02 AM ----------
I saw another post on a forum where someone was having issues with the tab key:
Using the script: (Called replaceit)
#!/bin/ksh
String=$1
Replace=$2
sed -e "s/${orig}/${new}/g" oldfile.txt > newfile.txt
In oldfile.txt, I'm looking for: getenv("Work")
And change it To: /u/web
I execute the script:
replaceit "getenv(\""Work\"")" /u/web
I'm getting sed... (3 Replies)
how to escape / (forward slash) in a string.
I have following scnerio:
sed s/${var1}{$var2}
var1 and var2 both contain slashes, but sed gives error if there is a slash in var1 or var2. sed is used here to replace var1 with var2.
Thanks in advance (1 Reply)
Hi all,
I need to know way of inserting backward slash before forward slash. My problem is that i need to supply directory path as an argument while invoking cshell script. This argument is further used in script (i.e. sed is used to insert this path in some file). So i need to place \ in front... (2 Replies)
What is the significance of the forward slash(/) while specifying a directory?
cp -av /dir/ /opt/
and
cp -av /dir /opt
Does effectively the same job it seems? (2 Replies)
i need to replace '/' forward slash with \/(backward slash follwed by a forward slash) using sed command when the forward slash occurs as a first character in a file..
Tried something like this but doesn't seem to work.
find $1 -print0 | xargs -0 sed -i -e 's/^\//\\\//g'
Can someone... (19 Replies)
hi
hope somebody can help, there seems to be bit on the net about this, but still cant make it work the way i need.
i have a file live this
mm dd ff /dev/name1
mm dd ff /dev/name2
mm dd ff /dev/name3
mm dd ff /dev/name4
i need to update /dev/name1 etc to /newdev/new/name1 etc
so... (5 Replies)
Hi,
I have a tab delimited file "test.txt" like this:
id1 342 C/T
id2 7453 T/A/-/G/C
id3 531 T/C
id4 756 A/T/G
id5 23 A/G
id6 717 T/A/C
id7 718 C/T/A
And so on, with the possible choices for letters being A,C,T,G.
I would like to exclude from my file all the lines that do not have... (3 Replies)
I have existing pattern in the perl script as:
my $pattern = "^Line.*?:|^Errors*: |^SEVERE:.*?:|^Null pointer exception occurred";
and I wanted to include below keywords in my search pattern
"I/O exception" and "FileNotFoundException"the problem is when I include my pattern like
my... (5 Replies)
./split2.sh: line 1: split/ssl/pop3s.txt: No such file or directory
sort: cannot read: split/ssl/pop3s.txt: No such file or directory
Hi there,
I am pulling data from the following source:
ssl/http
ssl/http
ssl/http-alt
ssl/https
ssl/https
ssl/https
ssl/https
ssl/https
ssl/https... (3 Replies)
Discussion started by: alvinoo
3 Replies
LEARN ABOUT DEBIAN
sort
sort(3perl) Perl Programmers Reference Guide sort(3perl)NAME
sort - perl pragma to control sort() behaviour
SYNOPSIS
use sort 'stable'; # guarantee stability
use sort '_quicksort'; # use a quicksort algorithm
use sort '_mergesort'; # use a mergesort algorithm
use sort 'defaults'; # revert to default behavior
no sort 'stable'; # stability not important
use sort '_qsort'; # alias for quicksort
my $current;
BEGIN {
$current = sort::current(); # identify prevailing algorithm
}
DESCRIPTION
With the "sort" pragma you can control the behaviour of the builtin "sort()" function.
In Perl versions 5.6 and earlier the quicksort algorithm was used to implement "sort()", but in Perl 5.8 a mergesort algorithm was also
made available, mainly to guarantee worst case O(N log N) behaviour: the worst case of quicksort is O(N**2). In Perl 5.8 and later,
quicksort defends against quadratic behaviour by shuffling large arrays before sorting.
A stable sort means that for records that compare equal, the original input ordering is preserved. Mergesort is stable, quicksort is not.
Stability will matter only if elements that compare equal can be distinguished in some other way. That means that simple numerical and
lexical sorts do not profit from stability, since equal elements are indistinguishable. However, with a comparison such as
{ substr($a, 0, 3) cmp substr($b, 0, 3) }
stability might matter because elements that compare equal on the first 3 characters may be distinguished based on subsequent characters.
In Perl 5.8 and later, quicksort can be stabilized, but doing so will add overhead, so it should only be done if it matters.
The best algorithm depends on many things. On average, mergesort does fewer comparisons than quicksort, so it may be better when
complicated comparison routines are used. Mergesort also takes advantage of pre-existing order, so it would be favored for using "sort()"
to merge several sorted arrays. On the other hand, quicksort is often faster for small arrays, and on arrays of a few distinct values,
repeated many times. You can force the choice of algorithm with this pragma, but this feels heavy-handed, so the subpragmas beginning with
a "_" may not persist beyond Perl 5.8. The default algorithm is mergesort, which will be stable even if you do not explicitly demand it.
But the stability of the default sort is a side-effect that could change in later versions. If stability is important, be sure to say so
with a
use sort 'stable';
The "no sort" pragma doesn't forbid what follows, it just leaves the choice open. Thus, after
no sort qw(_mergesort stable);
a mergesort, which happens to be stable, will be employed anyway. Note that
no sort "_quicksort";
no sort "_mergesort";
have exactly the same effect, leaving the choice of sort algorithm open.
CAVEATS
As of Perl 5.10, this pragma is lexically scoped and takes effect at compile time. In earlier versions its effect was global and took
effect at run-time; the documentation suggested using "eval()" to change the behaviour:
{ eval 'use sort qw(defaults _quicksort)'; # force quicksort
eval 'no sort "stable"'; # stability not wanted
print sort::current . "
";
@a = sort @b;
eval 'use sort "defaults"'; # clean up, for others
}
{ eval 'use sort qw(defaults stable)'; # force stability
print sort::current . "
";
@c = sort @d;
eval 'use sort "defaults"'; # clean up, for others
}
Such code no longer has the desired effect, for two reasons. Firstly, the use of "eval()" means that the sorting algorithm is not changed
until runtime, by which time it's too late to have any effect. Secondly, "sort::current" is also called at run-time, when in fact the
compile-time value of "sort::current" is the one that matters.
So now this code would be written:
{ use sort qw(defaults _quicksort); # force quicksort
no sort "stable"; # stability not wanted
my $current;
BEGIN { $current = print sort::current; }
print "$current
";
@a = sort @b;
# Pragmas go out of scope at the end of the block
}
{ use sort qw(defaults stable); # force stability
my $current;
BEGIN { $current = print sort::current; }
print "$current
";
@c = sort @d;
}
perl v5.14.2 2010-12-30 sort(3perl)