alan icon indicating copy to clipboard operation
alan copied to clipboard

sed in OS X 10.13.1 doesn't have -r flag for extended regex

Open mfcovington opened this issue 7 years ago • 1 comments

For OS X OS X 10.13.1, I get this error when running alan:

sed: illegal option -- r
usage: sed script [-Ealn] [-i extension] [file ...]
       sed [-Ealn] [-i extension] [-e script] ... [-f script_file] ... [file ...]

I thought maybe we need to use sed -E instead of sed -r to unlock the extended regex feature. however, that just returns this:

usage: grep [-abcDEFGHhIiJLlmnOoqRSsUVvwxZ] [-A num] [-B num] [-C[num]]
        [-e pattern] [-f file] [--binary-files=value] [--color=when]
        [--context[=num]] [--directories=action] [--label] [--line-buffered]
        [--null] [pattern] [file ...]

Running alanpartridge give me:

usage: grep [-abcDEFGHhIiJLlmnOoqRSsUVvwxZ] [-A num] [-B num] [-C[num]]
    [-e pattern] [-f file] [--binary-files=value] [--color=when]
    [--context[=num]] [--directories=action] [--label] [--line-buffered]
    [--null] [pattern] [file ...]
awk: invalid -v option

awk: invalid -v option

So, I think it may just be an issue of different versions of awk/sed/grep that have different flags/options available.

mfcovington avatar Nov 28 '17 23:11 mfcovington

Hi Mike,

Thanks for the input! The awk issue was a typo that should be fixed now. I don’t have access to a mac right now but I think that should be ironed out.

I think the –E option in sed probably did the job, the next issue would probably be the –P option in grep. Could you try replacing –vP with –v and seeing if that works? If so, I don’t think the –P is needed so I can get rid of it. I may also be able to work around the sed issue by escaping all special characters explicitly.

Hope that helps,

Michael

From: Mike Covington [mailto:[email protected]] Sent: 28 November 2017 23:41 To: mpdunne/alan [email protected] Cc: Subscribed [email protected] Subject: [mpdunne/alan] sed in OS X 10.13.1 doesn't have -r flag for extended regex (#1)

For OS X OS X 10.13.1, I get this error when running alan:

sed: illegal option -- r

usage: sed script [-Ealn] [-i extension] [file ...]

   sed [-Ealn] [-i extension] [-e script] ... [-f script_file] ... [file ...]

I thought maybe we need to use sed -E instead of sed -r to unlock the extended regex feature. however, that just returns this:

usage: grep [-abcDEFGHhIiJLlmnOoqRSsUVvwxZ] [-A num] [-B num] [-C[num]]

    [-e pattern] [-f file] [--binary-files=value] [--color=when]

    [--context[=num]] [--directories=action] [--label] [--line-buffered]

    [--null] [pattern] [file ...]

Running alanpartridge give me:

usage: grep [-abcDEFGHhIiJLlmnOoqRSsUVvwxZ] [-A num] [-B num] [-C[num]]

[-e pattern] [-f file] [--binary-files=value] [--color=when]

[--context[=num]] [--directories=action] [--label] [--line-buffered]

[--null] [pattern] [file ...]

awk: invalid -v option

awk: invalid -v option

So, I think it may just be an issue of different versions of awk/sed/grep that have different flags/options available.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/mpdunne/alan/issues/1, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AGCT1-PnjrcXobQOY2dLbUaGp83mSwE6ks5s7JoigaJpZM4QuMik.

mpdunne avatar Nov 29 '17 11:11 mpdunne