dscl Applescript carriage return query

Hi

I am trying to write an applescript that will populate some details from AD using dsl. I am stuck at the moment trying to work out how to get a value which has a carriage return

I currently have:

set loggedInUser to do shell script "whoami"
do shell script "dscl . -read /Users/" & loggedInUser 

Which shows the bit i am interested in below:

JobTitle:
Systems Engineer

I have tried the following but it just returns “JobTitle:”

set JobTitle to do shell script "dscl . -read /Users/" & loggedInUser & " | grep JobTitle: "

Please can someone tell me if it is possible to output the job title correctly as it seem difficult to grep also the carriage return and the space

This works for RealName (because I don’t have an entry named job title) and is also multiline

set loggedInUser to do shell script "whoami"
set realName to do shell script "dscl . -read /Users/" & loggedInUser & " RealName | tail -1 | sed -e 's/^ *//g;s/ *$//g'"

Thanks very much :smiley: i wouldn’t never have been able to work that out in a million years.