User Tools

Site Tools


opus:fall2012:eolson1:unixpart3

unix Keyword 3

Cut

Definition

Cut removes sections of each line of files.

Print selected parts of lines from each FILE to standard output.

References

  • cut man page

unix Keyword 3 Phase 2

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).

Demonstration

In this demonstration I am simply using two files to demonstrate diff and all it is doing is showing the differences between the files.

lab46:~$ diff text.txt text2.txt 
2,3c2,3
< this 
< is 
---
> these 
> are 
4a5
> yo
lab46:~$ 

In this demonstration i am using diff3 to examine three files line by line

lab46:~$ diff3 text.txt text2.txt text3.txt
====
1:1,3c
  hi
  this 
  is 
2:1,3c
  hi
  these 
  are 
3:1,4c
  hello
  these
  are
  sooo
====
1:4a
2:5c
  yo
3:6c
   
lab46:~$ 

In this demonstration i created a patch file then used it.

lab46:~$ diff -Naur text.txt text2.txt > new-patch
lab46:~$ patch -p0 <new-patch
patching file text.txt
lab46:~$ 
opus/fall2012/eolson1/unixpart3.txt · Last modified: 2012/11/30 20:39 by eolson1