|
|
|
|
|
by Someone
698 days ago
|
|
If it’s in POSIX, chances are the BSDs implement it, too. I think seeking a specific number of bytes and then writing data there will be a problem, though. For seeking n bytes, read nor sed will work; they work with lines. sed is the only one of those that can write, and POSIX doesn’t appear to have the -i option for in-place editing (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/s...) So, I think head for seeking followed by sed (or ed or vi, but sed is the simpler tool, I think) for replacing the first n characters, redirecting to a temp file and then doing a mv is your only option. Advantage will be that writes will be atomic; disadvantage that it will be slow |
|