summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2008-11-26 15:02:58 +0100
committerJim Meyering <meyering@redhat.com>2008-11-26 15:37:47 +0100
commitc7e971bee0aa606eef67c0f77711e3feeb5025f3 (patch)
tree4766abab5ee93a2e2ae6c767a17c7d461e5c2446 /doc
parentb0312caf6fc31f3f9826da46d7e8fce56cc94261 (diff)
downloadcoreutils-c7e971bee0aa606eef67c0f77711e3feeb5025f3.tar.xz
doc: factor out list of suffix-to-number (e.g., KB->1000B) mappings
* coreutils.texi (multiplierSuffixes, multiplierSuffixesNoBlocks): New macros. (od invocation, head invocation, tail invocation, split invocation): (truncate invocation): Use them.
Diffstat (limited to 'doc')
-rw-r--r--doc/coreutils.texi78
1 files changed, 44 insertions, 34 deletions
diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index d949973fb..16acd7e10 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -613,6 +613,44 @@ different functionality than that described here. Invoke it via
from the shell.
@end macro
+
+@macro multiplierSuffixes{varName}
+@ignore
+Appending @samp{b} multiplies @var{\varName\} by 512,
+@samp{kB} by 1000, @samp{K} by 1024,
+@samp{MB} by 1000*1000, @samp{M} by 1024*1024,
+@samp{GB} by 1000*1000*1000, @samp{G} by 1024*1024*1024,
+and so on for @samp{T}, @samp{P}, @samp{E}, @samp{Z}, and @samp{Y}.
+@end ignore
+@var{\varName\} is a number which may have one of the following
+multiplicative suffixes:
+@example
+@samp{b} => 512 ("blocks")
+@samp{KB} => 1000 (KiloBytes)
+@samp{K} => 1024 (KibiBytes)
+@samp{MB} => 1000*1000 (MegaBytes)
+@samp{M} => 1024*1024 (MebiBytes)
+@samp{GB} => 1000*1000*1000 (GibiBytes)
+@samp{G} => 1024*1024*1024 (GigaBytes)
+@end example
+and so on for @samp{T}, @samp{P}, @samp{E}, @samp{Z}, and @samp{Y}.
+@end macro
+
+@c FIXME: same as above, but no ``blocks'' line.
+@macro multiplierSuffixesNoBlocks{varName}
+@var{\varName\} is a number which may have one of the following
+multiplicative suffixes:
+@example
+@samp{KB} => 1000 (KiloBytes)
+@samp{K} => 1024 (KibiBytes)
+@samp{MB} => 1000*1000 (MegaBytes)
+@samp{M} => 1024*1024 (MebiBytes)
+@samp{GB} => 1000*1000*1000 (GibiBytes)
+@samp{G} => 1024*1024*1024 (GigaBytes)
+@end example
+and so on for @samp{T}, @samp{P}, @samp{E}, @samp{Z}, and @samp{Y}.
+@end macro
+
@cindex common options
Certain options are available in all of these programs. Rather than
@@ -1780,11 +1818,8 @@ The default is octal.
Skip @var{bytes} input bytes before formatting and writing. If
@var{bytes} begins with @samp{0x} or @samp{0X}, it is interpreted in
hexadecimal; otherwise, if it begins with @samp{0}, in octal; otherwise,
-in decimal. Appending @samp{b} multiplies @var{bytes} by 512,
-@samp{kB} by 1000, @samp{K} by 1024,
-@samp{MB} by 1000*1000, @samp{M} by 1024*1024,
-@samp{GB} by 1000*1000*1000, @samp{G} by 1024*1024*1024,
-and so on for @samp{T}, @samp{P}, @samp{E}, @samp{Z}, and @samp{Y}.
+in decimal.
+@multiplierSuffixes{bytes}
@item -N @var{bytes}
@itemx --read-bytes=@var{bytes}
@@ -2614,11 +2649,7 @@ The program accepts the following options. Also see @ref{Common options}.
Print the first @var{n} bytes, instead of initial lines.
However, if @var{n} starts with a @samp{-},
print all but the last @var{n} bytes of each file.
-Appending @samp{b} multiplies @var{n} by 512,
-@samp{kB} by 1000, @samp{K} by 1024,
-@samp{MB} by 1000*1000, @samp{M} by 1024*1024,
-@samp{GB} by 1000*1000*1000, @samp{G} by 1024*1024*1024,
-and so on for @samp{T}, @samp{P}, @samp{E}, @samp{Z}, and @samp{Y}.
+@multiplierSuffixes{n}
@itemx -n @var{n}
@itemx --lines=@var{n}
@@ -2703,11 +2734,7 @@ The program accepts the following options. Also see @ref{Common options}.
Output the last @var{n} bytes, instead of final lines.
However, if @var{n} starts with a @samp{+}, start printing with the
@var{n}th byte from the start of each file, instead of from the end.
-Appending @samp{b} multiplies @var{n} by 512,
-@samp{kB} by 1000, @samp{K} by 1024,
-@samp{MB} by 1000*1000, @samp{M} by 1024*1024,
-@samp{GB} by 1000*1000*1000, @samp{G} by 1024*1024*1024,
-and so on for @samp{T}, @samp{P}, @samp{E}, @samp{Z}, and @samp{Y}.
+@multiplierSuffixes{n}
@item -f
@itemx --follow[=@var{how}]
@@ -2920,16 +2947,7 @@ option syntax @option{-@var{lines}}. New scripts should use @option{-l
@opindex -b
@opindex --bytes
Put @var{size} bytes of @var{input} into each output file.
-@var{size} is a number which may be followed by one of these
-multiplicative suffixes:
-@example
-@samp{b} => 512 ("blocks")
-@samp{KB} => 1000 (KiloBytes)
-@samp{K} => 1024 (KibiBytes)
-@samp{MB} => 1000*1000 (MegaBytes)
-@samp{M} => 1024*1024 (MebiBytes)
-@end example
-and so on for @samp{G}, @samp{T}, @samp{P}, @samp{E}, @samp{Z}, and @samp{Y}.
+@multiplierSuffixes{size}
@item -C @var{size}
@itemx --line-bytes=@var{size}
@@ -10412,15 +10430,7 @@ Set the size of each @var{file} to the same size as @var{rfile}.
@opindex -s
@opindex --size
Set the size of each @var{file} to this @var{size}.
-@var{size} is a number which may be followed by one of these
-multiplicative suffixes:
-@example
-@samp{KB} => 1000 (KiloBytes)
-@samp{K} => 1024 (KibiBytes)
-@samp{MB} => 1000*1000 (MegaBytes)
-@samp{M} => 1024*1024 (MebiBytes)
-@end example
-and so on for @samp{G}, @samp{T}, @samp{P}, @samp{E}, @samp{Z}, and @samp{Y}.
+@multiplierSuffixesNoBlocks{size}
@var{size} may also be prefixed by one of the following to adjust
the size of each @var{file} based on their current size: