03-06-2012
It's a very simple change of the above script.
Right now, it splits on // i.e. nothing, so splits apart every charatcter. And joins together on "" i.e. nothing, so puts them back together with nothing inbetween.
/ / and " " would split/sort on spaces and put them back together with spaces inbetween.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
here is my perl script.This script creates an array and is sorting it using the in-built sort function in perl.
#!/usr/local/bin/perl
my number=6;
my @num_arr=(1,2,3,4,5);
my @array=(23,"$number","Hello",2.345,@num_arr);
#printing the array
print... (2 Replies)
Discussion started by: DILEEP410
2 Replies
2. Shell Programming and Scripting
Hi,
May I know, if a pipe separated File is large, what is the best method to calculate the unique row count of 3rd column and get a list of unique value of the 3rdcolum?
Thanks in advance! (20 Replies)
Discussion started by: deepakwins
20 Replies
3. Shell Programming and Scripting
Hi ,
I have
#echo $var1
#hdisk2 hdisk3 hdisk0 hdisk2
Now I need to remove duplicate entries from this . ie. after sorting it should only have
hdisk2 hdisk3 hdisk0 .
I can have these values in a array as well . I understand we can use sort -u to remove the duplicates in a... (2 Replies)
Discussion started by: praveenbvarrier
2 Replies
4. Shell Programming and Scripting
Hi all,
Say i have a array
@array=("abc,"a",ab");
I would like to sort them according to the length.
Any idea? thanks in advanced.
i tried below code, but not work.
sub sort_fun{
if (length shift(@_) >= length shift(@_) ){
return 1;
}
else{
return 0;
}
} (1 Reply)
Discussion started by: summer_cherry
1 Replies
5. Shell Programming and Scripting
Hi,
Can anyone advise how to correct my script pls?
I'm not getting the correct output =(
Details below:
Logfile
========
Player Num : 14
Player Name : Jacee Thirkins
MVP winner : 1998
End of details....
Player Num : 35
Player Name : Lander Diaz
MVP winner : 2002... (1 Reply)
Discussion started by: gholdbhurg
1 Replies
6. Shell Programming and Scripting
Hi
Is there any way I could reproduce the following code in perl 5.8:
sort -u FILE | sort -t: -k1,1 -k2n
which sorts by unicity first, then by first key, then by second key in numeric format.
What I have now is
@sort_array=uniq sort @sort_array;
after the contents of my... (5 Replies)
Discussion started by: Indalecio
5 Replies
7. UNIX for Advanced & Expert Users
I am getting the problem to sort these input in perl.
INPUT
------
Eddie-3
Michael-1
Nica-4
Montoya-6
Then the program should print the output as follows:
OUTPUT
-------
Michael-1
Eddie-3
Nica-4
Montoya-6
I am only able to sort to the words but I want to sort to numbers..
My... (5 Replies)
Discussion started by: mr_harish80
5 Replies
8. Shell Programming and Scripting
Hi,
can I sort the fields on the basis of dates in the following format?
from this
Dec 17 2007 2:18:18:000PM
Dec 17 2007 5:18:18:000AM
Jan 19 2009 4:30:02:000AM
Mar 21 2010 9:13:55:000AM
Dec 16 2007 4:29:21:000PM
Dec 24 2009 12:29:23:000PM
to
Dec 16 2007 4:29:21:000PM... (2 Replies)
Discussion started by: shellwell
2 Replies
9. Shell Programming and Scripting
i have a variable that has more than one value. i am declaring another variable, which will have the old variable data one by one. i want to use the second variable to hold the track of all the variable it has parsed from the first one. can somebody help me how do i declare and use the second... (7 Replies)
Discussion started by: gopajitmalakar
7 Replies
10. Shell Programming and Scripting
I have the following awk statement that computes rank of a column and sorts it based on rank.
sort -k6 -n file | awk '$6 != prev { rank = NR }{ print $1, $6, rank ; prev = $6 }'
I need the above code to accept variables for the column in the sort statement ("-k6").
Is there a better... (6 Replies)
Discussion started by: ncwxpanther
6 Replies
LEARN ABOUT POSIX
migratepages
MIGRATEPAGES(8) Linux Administrator's Manual MIGRATEPAGES(8)
NAME
migratepages - Migrate the physical location a processes pages
SYNOPSIS
migratepages pid from-nodes to-nodes
DESCRIPTION
migratepages moves the physical location of a processes pages without any changes of the virtual address space of the process. Moving the
pages allows one to change the distances of a process to its memory. Performance may be optimized by moving a processes pages to the node
where it is executing.
If multiple nodes are specified for from-nodes or to-nodes then an attempt is made to preserve the relative location of each page in each
nodeset.
For example if we move from nodes 2-5 to 7,9,12-13 then the preferred mode of operation is to move pages from 2->7, 3->9, 4->12 and 5->13.
However, this is only posssible if enough memory is available.
Valid node specifiers
all All nodes
number Node number
number1{,number2} Node number1 and Node number2
number1-number2 Nodes from number1 to number2
! nodes Invert selection of the following specification.
NOTES
Requires an NUMA policy aware kernel with support for page migration (linux 2.6.16 and later).
migratepages will only move pages that are not shared with other processes if called by a user without administrative priviledges (but with
the right to modify the process).
migratepages will move all pages if invoked from root (or a user with administrative priviledges).
FILES
/proc/<pid>/numa_maps for information about the NUMA memory use of a process.
COPYRIGHT
Copyright 2005-2006 Christoph Lameter, Silicon Graphics, Inc. migratepages is under the GNU General Public License, v.2
SEE ALSO
numactl(8) , set_mempolicy(2) , get_mempolicy(2) , mbind(2) , sched_setaffinity(2) , sched_getaffinity(2) , proc(5) , ftok(3) , shmat(2) ,
taskset(1)
SGI
Jan 2005 MIGRATEPAGES(8)