Mac sed unescaped newline inside substitute pattern

Ditto for the text arguments to the i and a functions: Various regex-matching and substitution options both in patterns for line selection and the first argument to the s function:. Control-character escape sequences: Unfortunately, this means that you cannot assume that features that work in FreeBSD, for instance, will work [the same] on macOS.

1 Introduction

The explanation is that you have a weird sed! For details, see the mac sed manual: Also, in the description of the -i option, it says that the extension is not optional, and that if you don't want one you must specify an empty argument. So everything makes sense in the end! This question already has an answer here: Replace comma with newline in sed on MacOS?

Shell Programming and Scripting

Brandon Ling Brandon Ling 1, 5 21 Jun 18 '14 at What shell are you using? The error message means that it's interpreting the string test1.

It's strange that the empty argument is necessary, but I think it's a red-herring relative to the problem with the newline. Labels and branching commands e. See below for details. If you need to support BOTH platforms discussion of differences: Incompatible features: Use of the -i option without an argument in-place updating without backup is incompatible: BSD sed: MUST use just -i equivalent: Note that in the absence of -i all versions number lines cumulatively across input files. If the last input line does not have a trailing newline and is printed: GNU sed: Common features: If you restrict your sed scripts to what BSD sed supports, they will generally work in GNU sed too - with the notable exception of using platform-specific extended regex features with -E.

Obviously, you'll also forgo extensions that are specific to the GNU version.

You are here

See next section. Sadly, this means that you won't be able to use several useful constructs, notably: Enumeration works great for Windows systems but it's a little wonky trying to make it work with Macs. All in all I'm trying to create something to make it more simple and reliable for the Windows admins so that it's more consistent for the Mac users.

The way I see it is if I can make this work then they could even have the option of using this on the Windows side with a simple powershell script kicked off with a login script. Maybe I can get cats and dogs to live together for a change. That's pretty much it in nutshell. The data being in a csv file is for having one field being used for documentation of what the share is for.

Some of them have had trouble with documenting this.

  1. sed error: unescaped newline.
  2. acer tablet find mac address?
  3. Table of Contents.

This won't enforce it but if there's a field right there that's empty, it might help them remember to fill it in with a description. If you have any insight on this or simply want to say "you're nuts", feel free.

sed error: unescaped newline

Yes, there are ways of doing this. Have you looked at Ben Toms' write up on how he was doing it from some years back? It may still be relevant, but I'm not certain. Worth a look anyway. Also search around on here because I'm sure there are some other threads on this very same topic, and there may already be some ready made solutions on there for you to look at. If a user has a home share defined in their AD record, you can grab that with dscl.

Your Answer

Either by looking at their local cached AD mobile account, or by searching against Active Directory itself. The following code should print out their home share, assuming those are actually set up. It wasn't clear from your description if they are or not. I assume they are, but you tell me. But with the above sed command you can convert it to a Mac friendly address. For something like this which only requires a single pattern substitution, you don't really need to use sed. Instead, just use Bash's built-in pattern substitution mechanism:.

Dialog with your fellow IT professionals, gain insight about Apple device deployments, share best practices and bounce ideas off each other. Join the conversation. Learn more about Jamf. Like Comment. Order by: Most Likes Oldest Newest.

If that isn't the case, the following code should work: I wasn't aware of that feature so that's good to know.