I’m doing some text manipulation and I want to replace the last occurrence of ” (with “, “four”) before ] which could be in different lines. (this essentially adds a new item in the array)
e.g:
1- array = ["one", "two", "three"] => array = ["one", "two", "three", "four"]
2-
array = ["one", "two",
"three"]
will become
array = ["one", "two",
"three", "four"]
3-
array = ["one", "two",
"three"
]
will become
array = ["one", "two",
"three", "four"
]
Tried sed and awk but couldn’t figure out how to do this
New contributor
kyles is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.