sed: regex input buffer length larger than INT_MAX
0
votes
4
answers
4145
views
I have a big file to which I am doing various operations, and this error just came up. I tried googling it but there didn't find any result with this.
sed: regex input buffer length larger than INT_MAX
My purpose is to quote every line, appending a comma,
and subsequently enclose the entirety of the file with square brackets
(as a single line).
For example, an input of
The quick brown fox
jumps over
the lazy dog.
should yield a result of
["The quick brown fox","jumps over","the lazy dog.",]
Assume that the input file doesn’t contain any quotes.
The code I run is this:
cat "${FILE}" | sed -e 's/.*/"&",/' | sponge "${FILE}"
truncate --size=-1 "${FILE}"
cat "${FILE}" | sed -z 's/.*/[&]/' | tr --delete '\n' | sponge "${FILE}"
sed version:
sed --version
sed (GNU sed) 4.5
Any thoughts?
Asked by Chris
(141 rep)
Jul 4, 2018, 11:35 PM
Last activity: May 28, 2025, 05:43 PM
Last activity: May 28, 2025, 05:43 PM