Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thypon/xopy
XopY the bytes swiss-army knife
https://github.com/thypon/xopy
Last synced: 21 days ago
JSON representation
XopY the bytes swiss-army knife
- Host: GitHub
- URL: https://github.com/thypon/xopy
- Owner: thypon
- Created: 2014-10-20T21:15:17.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2014-10-20T21:15:34.000Z (about 10 years ago)
- Last Synced: 2023-03-12T06:38:17.433Z (over 1 year ago)
- Language: Go
- Homepage:
- Size: 97.7 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
XopY
====XopY is the bytes swiss-army knife.
Given two files _x_ and _y_ xopy operates bytewise against them, giving a compound result.
The operations included are:- **eq**, copies _x/y_ bytes if _x/y_ bytes are equal, replaces with _pattern_ otherwise
- **and**, applies bitwise and against _x_ and _y_
- **or**, applies bitwise or against _x_ and _y_
- **xor**, applies bitwiser xor against _x_ and _y_
- **cut**, applies a cut returning _y_ bytes after a given _threshold_, _x_ bytes otherwiseExamples
--------$ echo -n "dogey" > dogey.txt
$ echo -n "doge" > doge.txt
$ echo -n "zarro" > zarro.txt
$ echo -n "lorem" > lorem.txt
### Eq$ xopy -x doge.txt -y dogey.txt | xxd
0000000: 646f 6765 00 doge.
### And$ xopy -x doge.txt -y dogey.txt -operation and | xxd
0000000: 646f 6765 08 doge.
### Or$ xopy -x doge.txt -y dogey.txt -operation or | xxd
0000000: 646f 6765 7b doge{
### Xor$ xopy -x doge.txt -y dogey.txt -operation xor | xxd
0000000: 0000 0000 73 ....s
### Cut$ xopy -x doge.txt -y zarro.txt -operation cut -threshold 2 | xxd
0000000: 646f 7272 6f dorro
#### PipeXopY is also easily pipable:
$ xopy -x doge.txt -y zarro.txt -operation cut -threshold 2 | xopy -y lorem.txt | xxd
0000000: 006f 7200 00 .or..
Usage
-----Usage of xopy:
-extend=false: Extend the file read to the longer one
-operation="eq": Select the operation: eq, and, or, xor, cut
-output="STDOUT": The Output File, STDOUT if not specified
-pattern="\x00": Select the replacing pattern
-threshold=8: selection threshold in cut mode
-x="STDIN": The X-file
-y="": The Y-file