Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: Working with SED maybe?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Working with SED maybe?



Le 29 mai 09 à 23:01, James Palmer a écrit :

I'm automating account creation here. To make a long story
short.........I have a Windoze admin that is spitting a script out for
me from the AD side. This is a script that has the shbang at the top
#!/bin/bash and then single lines of dseditgroup commands and an exit 0
at the end.

So, he's assuming the dseditgroup commands will always be successfull?


He can't get it to format the text for unix line endings.
So, the script he's generating won't execute.

I need to find out how I can take this file that's been created on the
Windoze side and replace all the line endings with Unix line
endings

Assuming the carriage return only appears in CRLF sequences, a single tr command could do the trick, by just deleting the carriage returns:


	tr -d '\r'

More info in the man page of tr(1).

.....OR.....The other idea was for him to spit everything out in
one giant line with pipes separating the commands then convert the pipes
into line endings but I'd need to figure out how to change a pipe
character into a line break character. : )

Again, tr may be of some use:

	tr '|' '\n'

HTH,
Axel _______________________________________________
Do not post admin requests to the list. They will be ignored.
Macos-x-server mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Working with SED maybe? (From: James Palmer <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.