I've two files, named as "__tmp.symbols" and "gap.tmLanguage" respectively, and they can be retrieved from here [1]. When I try to run the following sed command using these two files, an error will be triggered as follows:
$ sed -E -i "s/^(\s*<string>\\\b\().*IsGroup.*(\)\\\b<\/string>$)/\1$(cat ./__tmp.symbols)\2/g" gap.tmLanguage
bash: /usr/bin/sed: Argument list too long
Any hints for fixing it?
[1] https://github.com/hongyi-zhao/temp/tree/master/sed
Regards,
HZ
On 27.06.2022 05:59, hongy...@gmail.com wrote:
I've two files, named as "__tmp.symbols" and "gap.tmLanguage" respectively, and they can be retrieved from here [1]. When I try to run the following sed command using these two files, an error will be triggered as follows:
$ sed -E -i "s/^(\s*<string>\\\b\().*IsGroup.*(\)\\\b<\/string>$)/\1$(cat ./__tmp.symbols)\2/g" gap.tmLanguage
bash: /usr/bin/sed: Argument list too long
Any hints for fixing it?Obviously the contents of file __tmp.symbols are far too many so
that $(cat ./__tmp.symbols) will expand to a too long line.
My guess is that you wanted to do something different than putting
the whole content of a file into a sed _substitution argument_?
Anyway, to fix that use a more appropriate approach, like matching
the pattern and printing the contents at the matched place. A tool
like awk (for example) will provide you with that solution.
Janis
[1] https://github.com/hongyi-zhao/temp/tree/master/sed
Regards,
HZ
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 498 |
Nodes: | 16 (0 / 16) |
Uptime: | 68:27:14 |
Calls: | 9,814 |
Calls today: | 2 |
Files: | 13,755 |
Messages: | 6,189,407 |