Sorting lines N-N of a text file

By LiQuiDFLamE on Nov 21, 2007

/sortlines <N>*: Sorts lines N-N of the text file, it also echoes how long the process took.

alias sortlines { 
  if ($isfile($1) && $2-3) { 
    window -h @sort
    filter -arfw $+($2,-,$3) $1 @sort
    var %x = $2, %t = $ticks 
    while (%x <= $3) { 
      write $+(-l,%x) $1 $line(@sort,%x)
      inc %x
    }
    echo -ac info * Finished sorting lines $+($2,-,$3) in $+($calc(($ticks - %t) / 1000),s!) 
    window -c @sort
  }
}

Comments

Sign in to comment.
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.