Giter Club home page Giter Club logo

cut-trailing-bytes's Introduction

cut-trailing-bytes

A tool to cut trailing bytes, default cut trailing NULL(0x00 in hex) bytes

Example

$ echo "hello" > hello_00

$ dd if=/dev/zero bs=1k count=1 >> hello_00
1+0 records in
1+0 records out
1024 bytes (1.0 kB, 1.0 KiB) copied, 0.0031857 s, 321 kB/s

$ hexdump -C hello_00
00000000  68 65 6c 6c 6f 0a 00 00  00 00 00 00 00 00 00 00  |hello...........|
00000010  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000406

$ du -b hello_00
1030    hello_00

$ ./cut-trailing-bytes hello_00
cut hello_00 from 1030 to 6

$ hexdump -C hello_00
00000000  68 65 6c 6c 6f 0a                                 |hello.|
00000006

$ du -b hello_00
6       hello_00

$ echo "hello" > hello_ff

$ dd if=/dev/zero bs=1k count=1 | tr '\000' '\377' >> hello_ff
1+0 records in
1+0 records out
1024 bytes (1.0 kB, 1.0 KiB) copied, 0.0070723 s, 145 kB/s

$ hexdump -C hello_ff
00000000  68 65 6c 6c 6f 0a ff ff  ff ff ff ff ff ff ff ff  |hello...........|
00000010  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
*
00000406

$ du -b hello_ff
1030    hello_ff

$ ./cut-trailing-bytes hello_ff -c ff
cut hello_ff from 1030 to 6

$ hexdump -C hello_ff
00000000  68 65 6c 6c 6f 0a                                 |hello.|
00000006

zqb@WSL:~/workspace/rust/cut-trailing-bytes
$ du -b hello_ff
6       hello_ff

cut-trailing-bytes's People

Contributors

zqb-all avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.