Let's say I have two files containing arbitrary bytes: ./delimiter and ./data.
I want to read from ./data up to and excluding the first occurrence of the byte sequence in ./delimiter.
How would I do this using Bash?
Example:
- Content of
./delimiterworld - Content of
./datahelloworld - Expected result:
hello
Similar/Equivalent Question:
Note: read -d delim does not solve my problem, because it only support a single-character delimiter, not a string. Also, it stores the result in a variable, and variables don't support NUL bytes. I want the output on stdout.