With my Computer, it runs a Linux kernel and bash, i will make a technical-experiment.
I have a file, file.dat
, size = 1.048.576 byte
.
I will add at certain places in file.dat
some irregular (1…8 byte) random data from /dev/random
.
How to do that and how to remove the random data later?
By certain places i think at the Fibonacci Series, i found some scripts to generate this numbers:
#!/bin/bash
clear
echo "Program to Find Fibonacci Series"
echo "How many number of terms to be generated ?"
read n
x=0
y=1
i=2
echo "Fibonacci Series up to $n terms :"
echo "$x"
echo "$y"
while [ $i -lt $n ]
do
i=`expr $i + 1 `
z=`expr $x + $y `
echo "$z"
x=$y
y=$z
done
The other one:
# Read the value of n from user
echo -n "Enter the number of terms: "
read n
# Initialize variables
a=0
b=1
# Print the first two terms
echo -n "$a $b "
# Generate the Fibonacci series
for (( i=2; i<$n; i++ ))
do
c=$((a + b))
echo -n "$c "
a=$b
b=$c
done
echo
The Fibonacci Series says where to add sometimes 1 … upto 8 bytes to add with random data.
I know this blows up the 1.048.576 byte file.dat
, but that is what i am looking for.
Any ideas how to do that?