prepend

command
v1.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 8, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Command prepend inserts data read from stdin or an input file at the begining of the given file.

If data to prepend is passed both via stdin and input file, first the given file is prepended with data read from stdin, then from input file.

The prepend command does not load the files contents to the memory, making it suitable for large files. Writes issued by the prepend command are atomic, meaning if reading from stdin or input file fails the original file is left untouched.

Examples

Prepends package.go with 4 first lines of license.go file:

~ $ head -4 license.go | prepend package.go

Prepends package.go with preamble.txt only if the file does not beging with it already:

~ $ prepend -u -f preamble.txt package.go

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL