fcc

Crates.iofcc
lib.rsfcc
version0.4.2
sourcesrc
created_at2020-07-03 10:01:15.074756
updated_at2021-05-20 02:49:57.703985
descriptionFile concatenation utility
homepage
repositoryhttps://github.com/mapkts/fcc/
max_upload_size
id260958
size25,986
0x30 (mapkts)

documentation

https://docs.rs/fcc/

README

fcc

Crates.io Linux build status Windows build status

A command line utility for file concatenation, featuring:

  • Accepts input files from either STDIN or arg -i.
  • Writes concatenation result to either STDOUT or a specific file given by arg -o.
  • Allows you to skip unwanted contents of each source from either start or end.
  • Allows you to fill some paddings before, between and/or after each source.
  • Allows you to force the presence of ending newlines after each source.

See fcc --help for more help information on how to use this command line utility. And if you want a rust library that provides similar functionalities, see admerge.

Examples

Assumes we have three text files 1.txt, 2.txt and 3.txt in current working directory.

The content of 1.txt is:

111 112 113
121 122 123
131 132 133

The content of 2.txt is:

211 212 213
221 222 223
231 232 233

The content of 3.txt is:

311 312 313
321 322 323
331 332 333

Concatenate them without configurations.

find [1-3].txt | fcc

or

echo [1-3].txt | fcc

or

fcc -i 1.txt 2.txt 3.txt

will print the following text to stdout

111 112 113
121 122 123
131 132 133211 212 213
221 222 223
231 232 233311 312 313
321 322 323
331 332 333

Concatenate them with --newline

echo [1-3].txt | fcc -n

will print the following text to stdout:

111 112 113
121 122 123
131 132 133
211 212 213
221 222 223
231 232 233
311 312 313
321 322 323
331 332 333

Concatenate them with skip-head=1 and skip-tail=1

echo [1-3].txt | fcc -n --skip-head=1 --skip-tail=1

will print the following text to stdout:

121 122 123
221 222 223
321 322 323

Concatenate them with newline and --headonce

echo [1-3].txt | fcc -n --headonce

will print the following text to stdout:

111 112 113
121 122 123
131 132 133
221 222 223
231 232 233
321 322 323
331 332 333

Concatenate them with --newline and padding="padding between\n"

echo [1-3].txt | fcc -n --padding="padding between
"

will print the following text to stdout:

111 112 113
121 122 123
131 132 133
padding between
211 212 213
221 222 223
231 232 233
padding between
311 312 313
321 322 323
331 332 333

Installation

Binaries for Windows, Linux and macOS are available from Github.

You can also compile the binary from source using Cargo:

git clone git://github.com/mapkts/fcc
cd fcc
cargo build --release

Compilation will probably take a few minutes depending on your machine. The binary will end up in ./target/release/fcc.

License

fcc is distributed under the terms of either the MIT license or the Apache License (Version 2.0).

See the LICENSE-APACHE and LICENSE-MIT files in this repository for more information.

Commit count: 52

cargo fmt