Check Doubles

By Phase on Jan 04, 2005

Synax: /checkdoubles
What this does: It will check every line of a text file and if two lines match, it will remove one.

alias checkdoubles {
  set %lcv.chkdbl 1
  while (%lcv.chkdbl <= $lines($1-)) {
    hadd -m chkdbl $read($1-,%lcv.chkdbl) 1
    inc %lcv.chkdbl
  }
  set %lcv.chkdbl 1
  write -c " $+ $1- $+ "
  while (%lcv.chkdbl <= $hget(chkdbl,0).data) {
    write " $+ $1- $+ " $hget(chkdbl,%lcv.chkdbl).item
    inc %lcv.chkdbl
  }
  unset %lcv.chkdbl
  hfree chkdbl
}

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.