From 06942171bdc01591e4e9f18acb42ecc05ff4cbe2 Mon Sep 17 00:00:00 2001 From: James O'Beirne Date: Wed, 22 Aug 2018 17:26:12 -0400 Subject: [PATCH] sed: get nth line of a file --- pages/common/sed.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pages/common/sed.md b/pages/common/sed.md index 3316741d71..22114bf287 100644 --- a/pages/common/sed.md +++ b/pages/common/sed.md @@ -33,3 +33,7 @@ - Replace separator / by any other character not used in the find or replace patterns, e.g., #: `sed 's#{{find}}#{{replace}}#' {{filename}}` + +- Print only the `N`th line of a file: + +`sed '{{N}}q;d' {{filename}}`