Created
December 3, 2017 12:28
-
-
Save nnabeyang/0b310f78d12aa14887d834ceb4bd4903 to your computer and use it in GitHub Desktop.
ファイルの最後にヌルバイトを追加する。追加後と追加前で差異が無いかチェックする
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
ls -l $1 | awk '{print $5,$10}'| | |
while read n f | |
do | |
if [ "$f" != "" ]; then | |
xxd -p "$2/$f" | fold -w2 | head -n $n | diff -u "$3/$f" - | |
fi | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -xe | |
SRC=$1 | |
DEST=$2 | |
SIZE=$3 #1472 | |
[ -d txt ] && rm -rf txt | |
[ -d "$DEST" ] && rm -rf "$DEST" | |
mkdir txt | |
mkdir "$DEST" | |
echo "print '0' * (${SIZE} * 2)" | python > null.txt | |
./mkdata.bash "$SRC" ${SIZE} ${DEST} | |
./txt.bash "$SRC" | |
./diff.bash $SRC $DEST txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -xe | |
[ -d $1 ] && exit 1 | |
mkdir $1 | |
seq 1 $2 | | |
while read n | |
do | |
if [ "$n" != "" ]; then | |
cp $3 "$1/$n.bin" | |
fi | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
append-null() { | |
xxd -p "$1/$2" | cat - null.txt | xargs | sed 's/ //g'|awk "{print substr(\$1, 1, 2 * $3)}" | xxd -r -p | |
} | |
ls -l $1 | awk '{print $5,$10}' | | |
while read n f | |
do | |
if [ "$f" != "" ]; then | |
append-null $1 $f $2 > "$3/$f" | |
fi | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
ls -l $1 | awk '{print $10}' | | |
while read f | |
do | |
if [ "$f" != "" ]; then | |
xxd -p "$1/$f" | fold -w2 > "txt/$f" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment