Sample Header Ad - 728x90

How can I remove multi-line (Lua) comments in a bash script?

1 vote
2 answers
543 views
I'm writing a bash script where I need to strip comments from Lua files, which are formatted:
--like this

foo="bar" --or like this

--[[ or like this ]]

--[[
    or
    like
    this
]]
I know I can use sed 's/--.*$//' ${my_file} to remove the single-line comments, but how can I address the multi-line one? Thanks!
Asked by ridgek (25 rep)
Nov 25, 2021, 10:07 AM
Last activity: Nov 25, 2021, 10:43 AM