Ana içeriğe atla

Kayıtlar

Ağustos, 2009 tarihine ait yayınlar gösteriliyor

Rarely known unix text utilities

I have come across with some new text commands in a book that I hadnt seen before .These are : fmt, tac, join,(un)expand,split. Among them I am very impressed by join which makes an Sql-like join between 2 (or more I guess) files which is very useful.Here an example:Suppose you have two files whose one columns are equal (or contains same information, like an id column of sql) and you want to join these files with respect to tht column.You simply write join file1 file2 if the first columns of file1 and file2 are common. If the common column is not first you can define it by -1 clnr or -2 clnr switches. There is also an -o switch which is useful for formatting output.To print the first and second columns from file 1 and say third column from file2 we write -o 1.1,1.2,2.3 .Here is a complete example join file1 file2 -j 3 -o 1.1,1.3,2.2 . Split is another nice command which splits larger files into smaller ones to easily handle them (when uploading,transferring etc). You just write split -...