From 2c33737ccb39296e83e0325b02a83ee7e1c5c95f Mon Sep 17 00:00:00 2001 From: joel Date: Sat, 16 Mar 2013 22:53:38 +0000 Subject: [PATCH] Add a couple of examples. Obtained from: OpenBSD --- usr.bin/head/head.1 | 15 ++++++++++++++- usr.bin/tail/tail.1 | 13 ++++++++++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/usr.bin/head/head.1 b/usr.bin/head/head.1 index 0e16477aae28..9bc341359684 100644 --- a/usr.bin/head/head.1 +++ b/usr.bin/head/head.1 @@ -28,7 +28,7 @@ .\" @(#)head.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd June 6, 1993 +.Dd March 16, 2013 .Dt HEAD 1 .Os .Sh NAME @@ -57,6 +57,19 @@ where is the name of the file. .Sh EXIT STATUS .Ex -std +.Sh EXAMPLES +To display the first 500 lines of the file +.Ar foo : +.Pp +.Dl $ head -n 500 foo +.Pp +.Nm +can be used in conjunction with +.Xr tail 1 +in the following way to, for example, display only line 500 from the file +.Ar foo : +.Pp +.Dl $ head -n 500 foo | tail -n 1 .Sh SEE ALSO .Xr tail 1 .Sh HISTORY diff --git a/usr.bin/tail/tail.1 b/usr.bin/tail/tail.1 index d4ec2f9ad457..4779bc17407a 100644 --- a/usr.bin/tail/tail.1 +++ b/usr.bin/tail/tail.1 @@ -31,7 +31,7 @@ .\" @(#)tail.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd June 5, 2009 +.Dd March 16, 2013 .Dt TAIL 1 .Os .Sh NAME @@ -147,6 +147,17 @@ is the name of the file unless flag is specified. .Sh EXIT STATUS .Ex -std +.Sh EXAMPLES +To display the last 500 lines of the file +.Ar foo : +.Pp +.Dl $ tail -n 500 foo +.Pp +Keep +.Pa /var/log/messages +open, displaying to the standard output anything appended to the file: +.Pp +.Dl $ tail -f /var/log/messages .Sh SEE ALSO .Xr cat 1 , .Xr head 1 ,