-2

write a script name to read file name from the end user and remove duplicate line from in that file.

#! /bin/bash read -p "Enter any file name to remove duplicate line:" $fname sort -u $fname > tmp.txt mv tmp.txt > $fname

here duplicate line will be remove but my content will be sorted but i don't that what should i do.

i want another method to remove duplicate line in shell scripting.

1 Answers1

-2

You can remove duplicate lines by the 'uniq' command.