Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 09-08-2015, 12:18 PM   #1
LQ Newbie
Registered: Sep 2015
Posts: 23

Rep: Reputation: Disabled
Question how to find unique digits within each column in a txt.file in linux ?

Hi, I have a data like this :

col1 col2 col3 col4...
123 000 111 565
232 123 123 565
123 123 123 565
123 000 123 565

and I want my output be like this:

col1 col2 col3 col4 ...
123 000 111 565
232 123 123

I used this command:

input.txt '{print $1}' | sort | uniq > output.txt

which give me what I want only for the first column, But I have too many columns which I can not do that one by one by this command. Can you guide me please?
Old 09-08-2015, 02:11 PM   #2
LQ Guru
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,043
Blog Entries: 14

Rep: Reputation: 1213Reputation: 1213Reputation: 1213Reputation: 1213Reputation: 1213Reputation: 1213Reputation: 1213Reputation: 1213Reputation: 1213
Duplicate post


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to find unique characters within each column in a txt.file in linux ? Rozak Programming 45 09-09-2015 11:57 PM
Can't find a file in cmake.txt chiara90 Linux - Newbie 2 03-19-2014 03:02 PM
[SOLVED] Is there a way to unique by column/field? mitter1989 Linux - Software 2 10-19-2013 06:59 AM
Compare file extension from two different txt file and find the differences. Neal000 Programming 6 08-28-2012 03:03 PM
How can I use Shell script to edit row 23 column 5-8 in a txt file? leena_d Linux - Newbie 4 12-14-2009 04:43 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:10 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration