How to Remove Duplicate lines from Unix vi Editor file

advertisements

_____________________________________________________________________________________________________________________

The Eucharistic Miracles of the World
Sometimes we have the requirement for removing the duplicate lines from the text file. For that we can easily use vi to remove the duplicate lines instead of using any other scripts or tools. Here are the options to remove the duplicate lines from the vi file.


Option1
Open the vi file and in command mode (press esc) give the command :sort u
The above command will sort the file which will give the file with duplicate lines closer. Now you can remove the duplicate lines.

Option2
1G #### Go to first line of the file
!Gsort ## Sort the file from the first line
1G #### Again go to first line
!Guniq ## Remove duplicate with uniq command.

_____________________________________________________________________________________________________________________

A visitor from London viewed 'How to Find out / Check SGA and PGA size of Oracle' 13 mins ago
A visitor from Chennai viewed 'Data Pump impdp expdp : SQLFILE option to extract ' 2 hrs 48 mins ago
A visitor from Apex viewed 'Oracle INDEX hint : Different usage syntax for per' 3 hrs 15 mins ago
A visitor from Egypt viewed 'Where You Can Find the Oracle 11g 12c DBCA Install' 5 hrs 20 mins ago
A visitor from Louisiana viewed 'How to Check Oracle 11g 12c Database Wallet is Ope' 5 hrs 21 mins ago

0 comments:

Post a Comment

Labels

Oracle (629) Script (86) General (77) Unix (47) Blog (23) Technology (19) gadget (6) games (6) Business (3) OCI (3) SQL* Loader (3) Datapump (2)
 

acehints.com Copyright 2011-25 All Rights Reserved | Site Map | Contact | Disclaimer