Page MenuHomeFreeBSD

D25186.id72820.diff
No OneTemporary

D25186.id72820.diff

Index: join/join.1
===================================================================
--- join/join.1
+++ join/join.1
@@ -164,6 +164,125 @@
the standard input is used.
.Sh EXIT STATUS
.Ex -std
+.Sh EXAMPLES
+Assuming a file named nobel_laureates.txt with information about the first Nobel
+Peace Prize laureates:
+.Bd -literal -offset indent
+1901,Jean Henri Dunant,M
+1901,Frederic Passy,M
+1902,Elie Ducommun,M
+1902,Charles Albert Gobat,M
+1903,Sir William Randal Cremer,M
+1904,Institute Of International Law,
+1905,Baroness Bertha Sophie Felicita Von Suttner,F
+1906,Theodore Roosevelt,M
+1907,Ernesto Teodoro Moneta,M
+1907,Louis Renault,M
+1908,Klas Pontus Arnoldson,M
+1908,Fredrik Bajer,M
+1909,Auguste Marie Francois Beernaert,M
+1909,Paul Henri Benjamin Balluet d'Estournelles de Constant,M
+1910,Permanent International Peace Bureau,
+.Ed
+.Pp
+and a second file nobel_nationalities.txt with their nationalities:
+.Bd -literal -offset indent
+Jean Henri Dunant,Switzerland
+Frederic Passy,France
+Elie Ducommun,Switzerland
+Charles Albert Gobat,Switzerland
+Sir William Randal Cremer,UK
+Institute Of International Law,Belgium
+Baroness Bertha Sophie Felicita Von Suttner
+Theodore Roosevelt,USA
+Ernesto Teodoro Moneta,Italy
+Louis Renault,France
+Klas Pontus Arnoldson,Sweden
+Fredrik Bajer,Denmark
+Auguste Marie Francois Beernaert,Belgium
+Paul Henri Benjamin Balluet d'Estournelles de Constant,France
+.Ed
+.Pp
+Join the two files using the second column from first file and the default first
+column from second file specifying a custom field delimiter:
+.Bd -literal -offset indent
+$ join -t, -1 2 nobel_laureates.txt nobel_nationalities.txt
+Jean Henri Dunant,1901,M,Switzerland
+Frederic Passy,1901,M,France
+Elie Ducommun,1902,M,Switzerland
+Charles Albert Gobat,1902,M,Switzerland
+Sir William Randal Cremer,1903,M,UK
+Institute Of International Law,1904,,Belgium
+Baroness Bertha Sophie Felicita Von Suttner,1905,F
+Theodore Roosevelt,1906,M,USA
+Ernesto Teodoro Moneta,1907,M,Italy
+Louis Renault,1907,M,France
+Klas Pontus Arnoldson,1908,M,Sweden
+Fredrik Bajer,1908,M,Denmark
+Auguste Marie Francois Beernaert,1909,M,Belgium
+Paul Henri Benjamin Balluet d'Estournelles de Constant,1909,M,France
+.Ed
+.Pp
+Show only the year and the nationality of the laureate using "<<NULL>>" to
+replace empty fields:
+.Bd -literal -offset indent
+$ join -e "<<NULL>>" -t, -1 2 -o "1.1 2.2" nobel_laureates.txt nobel_nationalities.txt
+1901,Switzerland
+1901,France
+1902,Switzerland
+1902,Switzerland
+1903,UK
+1904,Belgium
+1905,<<NULL>>
+1906,USA
+1907,Italy
+1907,France
+1908,Sweden
+1908,Denmark
+1909,Belgium
+1909,France
+.Ed
+.Pp
+Show only lines from first file which don't have a match in second file:
+.Bd -literal -offset indent
+$ join -v1 -t, -1 2 nobel_laureates.txt nobel_nationalities.txt
+Permanent International Peace Bureau,1910,
+.Ed
+.Pp
+Assuming a file named capitals.txt with the following content:
+.Bd -literal -offset indent
+Belgium,Brussels
+Denmark,Copenhagen
+France,Paris
+Italy,Rome
+Sweden,Stockholm
+Switzerland,
+UK,London
+USA,Washington
+.Ed
+.Pp
+Show the name and capital of the country where the laureate was born.
+This example uses nobel_nationalities.txt as a bridge but doesn't show any
+information from that file.
+Also see the note about
+.Xr sort 1
+above to understand why we need to sort the intermediate result.
+.Bd -literal -offset indent
+$ join -t, -1 2 -o 1.2 2.2 nobel_laureates.txt nobel_nationalities.txt | sort -k2 -t, | join -t, -1 2 -o 1.1 2.2 - capitals.txt
+Auguste Marie Francois Beernaert,Brussels
+Institute Of International Law,Brussels
+Fredrik Bajer,Copenhagen
+Frederic Passy,Paris
+Louis Renault,Paris
+Paul Henri Benjamin Balluet d'Estournelles de Constant,Paris
+Ernesto Teodoro Moneta,Rome
+Klas Pontus Arnoldson,Stockholm
+Charles Albert Gobat,
+Elie Ducommun,
+Jean Henri Dunant,
+Sir William Randal Cremer,London
+Theodore Roosevelt,Washington
+.Ed
.Sh COMPATIBILITY
For compatibility with historic versions of
.Nm ,

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 14, 12:42 PM (10 h, 44 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
25287857
Default Alt Text
D25186.id72820.diff (3 KB)

Event Timeline