Shell Script Which Will Discards All But One of Successive Identical

by admin on July 24, 2009 · 0 comments

#!/bin/bash
# Write the shell program unique, which will discards all but one of successive
# identical
# --------------------------------------------------------------------
# This is a free shell script under GNU GPL version 2.0 or above
# Copyright (C) 2005 nixCraft project.
# Feedback/comment/suggestions : http://cyberciti.biz/fb/
# -------------------------------------------------------------------------
# This script is part of nixCraft shell script collection (NSSC)
# Visit http://bash.cyberciti.biz/ for more information.
# -------------------------------------------------------------------------
echo -n "Enter file name : "
read file
 
if [ ! -f $file ]
then
	echo "Not a file"
	exit 1
fi
 
uniq $file

Previous post:

Next post: