On 12Feb2017 20:06, bruce <badouglas(a)gmail.com> wrote:
Got a quick sed question now..
head -2 sed.dat
I always say "sed 2q" instead of "head -2", myself.
want to simply truncate/search/replace the end of each line starting
with the ","
the following isn't working
sed -i 's/\,+\$//' sed.dat
sed -i 's/\,+$//' sed.dat
1: You're in single quotes (generally desirable), so "," and "$"
are not shell
special characters and need no backslashes.
2: I don't know what your intend with the "+" is. Firstly, by default sed
Basic Regular Expressions, which do not include "+". Secondly, "+" is
character meaning "1 or more or the preceeding item", so you're saying
the first instance of one or more commas". Except that with BREs you're saying
"delete the first comma followed by a plus" because "+" is not
I'd test without the "-i" until you have things working.
Cameron Simpson <cs(a)zip.com.au>