Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

bash remove duplicate lines from a file

# Basic syntax:
sort input_file | uniq --unique
# Sort the file first because uniq requires a sorted file to work. Uniq
# then eliminates all duplicated lines in the file, keeping one instance
# of each duplicated line

# Note, this doesn't return only non-duplicated lines. It returns
# unique instances of all lines, whether or not they are duplicated

# Note, if you want to return only one instance of all lines but see
# the number of repetitions for each line, run:
sort input_file | uniq -c
Comment

PREVIOUS NEXT
Code Example
Shell :: powershell change hostname 
Shell :: how to logout of git in terminal 
Shell :: bash create file with content 
Shell :: Library not loaded: /opt/homebrew/opt/icu4c/lib/libicui18n.69.dylib 
Shell :: grep before and after 
Shell :: linux filter groups 
Shell :: how to uninstall gitlab in ubuntu 
Shell :: upgrade nltk version 
Shell :: java change version mac 
Shell :: Failed to start Redis In-Memory Data Store. 
Shell :: install curl mac 
Shell :: unable to start ssh-agent service, error :1058 
Shell :: capacitor live reload 
Shell :: download vlc for ubuntu 
Shell :: save git username and password 
Shell :: get current working directory powershell 
Shell :: git access denied 
Shell :: install atom ubuntu terminal 
Shell :: install ldapsearch 
Shell :: black webbrowser 
Shell :: git set commit date 
Shell :: git ignore whitespace 
Shell :: install uvicorn 
Shell :: git remove folder remotely 
Shell :: sudo command not found 
Shell :: delete local branches not on remote 
Shell :: uninstall r from mac 
Shell :: how to install minilibx in linux 
Shell :: django fake initial migration 
Shell :: git ignore still tracking 
ADD CONTENT
Topic
Content
Source link
Name
1+6 =