I'm trying to replace the last ,
in a command output
EXTRACT_JIRA_TICKETS=$(GIT_LOGS) | grep -e '[A-Z]\+-[0-9]\+' -o | sort -u | tr '\n' ',' | sed 's/,$/\n/'
.Phony: check-jira-tickets
check-jira-tickets: ## checks if there are merged tickets without fix version
@export JIRA_TICKETS_IDS=$(shell $(EXTRACT_JIRA_TICKETS)); \
echo $${JIRA_TICKETS_IDS};
I've tried to escape the sed params with double quotes and nothing worked so far on Mac OS
$ make check-jira-tickets
sed: 1: "s/,\n/": unterminated substitute in regular expression
If I remove the pipe with sed it works
$ make check-jira-tickets
BEN-2783,
A single dollar sign is special to make
(here, it interprets $/
as a make variable).
Double the dollar signs you want to propagate to the shell:
... | sed 's/,$$/\n/'
~~