Skip to Content
Linux in a Nutshell, 6th Edition
book

Linux in a Nutshell, 6th Edition

by Ellen Siever, Stephen Figgins, Robert Love, Arnold Robbins
September 2009
Beginner
942 pages
85h 34m
English
O'Reilly Media, Inc.
Content preview from Linux in a Nutshell, 6th Edition

Name

printf

Synopsis

printf [-v var] format [val ...]

Format the specified values according to the format format and write them to standard output. The possible format character strings are those of the ANSI C printf function plus several additional strings.

Option

-v var

Write output to the variable var instead of standard output.

Additional format strings

%b

Expand escape sequences in strings (e.g., \t to tab, and so on).

%q

Print a quoted string that can be reread later on.

Example

$ date             Reformat date/time
Fri May 15 15:39:42 EDT 2009
$ printf "%(It is now %m/%d/%Y %H:%M:%S)T\n" "$(date)"
It is now 05/15/2009 15:40:10
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Unix in a Nutshell, 4th Edition

Unix in a Nutshell, 4th Edition

Arnold Robbins
Linux Under the Hood

Linux Under the Hood

Sander van Vugt
Linux Kernel in a Nutshell

Linux Kernel in a Nutshell

Greg Kroah-Hartman

Publisher Resources

ISBN: 9780596806088Errata Page