User Tools

Site Tools


opus:fall2012:khoose2:unixpart3

unix Keyword 3

diff/diff3/patch

Definition

Operations used to compare files, outputting their differences, and is often used to tell the differences between versions of the same file.

References

List any sites, books, or sources utilized when researching information on this topic. (Remove any filler text).

unix Keyword 3 Phase 2

sort/uniq

Definition

The sort commands sorts the the lines of text files in order. You can use different arguments like -r to sort them in reverse order. The uniq command is used with the sort command to remove duplicate lines in the file that you are sorting. There are also arguments for uniq like -d that only prints duplicated lines or -u that only prints unique lines.

References

List any sites, books, or sources utilized when researching information on this topic. (Remove any filler text).

Demonstration

Demonstration of the indicated keyword.

If you wish to aid your definition with a code sample, you can do so by using a wiki code block, an example follows:

Alternatively (or additionally), if you want to demonstrate something on the command-line, you can do so as follows: SORT:

lab46:~/src/class$ vim testdata
'testdata'  
  1 alpha
  2 beta
  3 zeta
  4 kapa
  5 kapa
  6 sigma
  7 sigma
  8 foxtrot
  9 foxtrot
  10 delta
  11 hotel
lab46:~/src/class$ sort -d testdata
alpha
beta
delta
foxtrot
foxtrot
hotel
kapa
kapa
sigma
sigma
zeta

UNIQ:

lab46:~/src/class$ vim testdata
'testdata'  
  1 alpha
  2 beta
  3 zeta
  4 kapa
  5 kapa
  6 sigma
  7 sigma
  8 foxtrot
  9 foxtrot
  10 delta
  11 hotel
lab46:~/src/class$ uniq -d testdata
kapa
sigma
foxtrot
opus/fall2012/khoose2/unixpart3.txt · Last modified: 2012/11/30 23:04 by khoose2