cat - Concatenate object content to stdout

Synopsis

gsutil cat [-h] url...

Description

The cat command outputs the contents of one or more URLs to stdout. While the cat command does not compute a checksum, it is otherwise equivalent to doing:

gsutil cp url... -

(The final '-' causes gsutil to stream the output to stdout.)

Options

-h

Prints short header for each object. For example:

gsutil cat -h gs://bucket/meeting_notes/2012_Feb/*.txt

This would print a header with the object name before the contents of each text object that matched the wildcard.

-r range

Causes gsutil to output just the specified byte range of the object. Ranges are can be of these forms:

start-end (e.g., -r 256-5939)
start-    (e.g., -r 256-)
-numbytes (e.g., -r -5)

where offsets start at 0, start-end means to return bytes start through end (inclusive), start- means to return bytes start through the end of the object, and -numbytes means to return the last numbytes of the object. For example:

gsutil cat -r 256-939 gs://bucket/object

returns bytes 256 through 939, while:

gsutil cat -r -5 gs://bucket/object

returns the final 5 bytes of the object.