Pádraig Brady wrote:
> Nexor wrote:
>> I would love to see the --delimiter option accept (and use) strings
>> longer than one character - what do you think?
>
> Well one often requires more general regular expression matching
> in addition to string matching, and keeping both within a tool like
> sed is probably more cohesive? If one wanted to split on "--" for
> example then you could do somthing like:
>
> echo "1--2--3" | sed 's/--/\x00/g' | cut -d '' -f2

I find awk to be my usual choice when doing things like this.

  $ echo 1--2--3 | awk -F-- '{print$1,$3}'
  1 3

Both awk and sed have an advantage of being standardized and being
readily available in every POSIX environment.

Bob


Reply via email to