Let’s say you have two text files, FileA and FileB. You want a file that has all the lines of FileA that are_ not_ in FileB. How do you do that?
The simple answer is
-v option inverts the search, and only prints
lines that do not match. The
-f option is used to specify a file that
contains a list of all the patterns for which to look - one pattern per line.
I remember in my first Computer Programming class in college, the instructors wanted to make sure we understood the concept of persistence by saving application data to disk. To keep things simple we would serialize data and save it to text files. Once we learned advanced concepts we migrated to using relational databases. As a professional, most of the apps I see use an RDBMS like DB2, PostgreSQL, Sybase or Oracle. Text files have been relegated to the simple homework assignments of Programming 101.
There are, however, many classes of applications for which text files are the preferred means of storing data. One of the main reasons is that when data is stored in a relational database, editing it is not a trivial task. A well-normalized database is not easily updated via an SQL command line. More often than not, a dedicated, graphical editor is needed to model the complex relationships.