Extension attribute help

tkimpton
Valued Contributor II

Hello

I have an extension attribute which does a simply cat of a txt file.

The problem is the txt file has carriage returns in it and I would like to include them because the recon inventory shows all the information bunched together and i need to be able to separate the data Can anyone help at all?

2 ACCEPTED SOLUTIONS

sean
Valued Contributor

Welcome to my feature request. It used to, but Jamf stopped it doing this. Add yourself to the request and send your jamf contact the same information.

https://jamfnation.jamfsoftware.com/featureRequest.html?id=110

Sean

View solution in original post

rmanly
Contributor III

Here is a way to translate the newlines into a different delimiter so you can parse it back out later.

$ cat test
blah
blah
blah
$ echo "<result>$(cat test | tr "
" ":")</result>"
<result>blah:blah:blah:</result>
$

*shrug*

May help a bit in the meantime.

View solution in original post

6 REPLIES 6

sean
Valued Contributor

Welcome to my feature request. It used to, but Jamf stopped it doing this. Add yourself to the request and send your jamf contact the same information.

https://jamfnation.jamfsoftware.com/featureRequest.html?id=110

Sean

tkimpton
Valued Contributor II

Thanks very much

rmanly
Contributor III

Here is a way to translate the newlines into a different delimiter so you can parse it back out later.

$ cat test
blah
blah
blah
$ echo "<result>$(cat test | tr "
" ":")</result>"
<result>blah:blah:blah:</result>
$

*shrug*

May help a bit in the meantime.

tkimpton
Valued Contributor II

Hi rmanly

Please can you help i am not clear on your solution. I am currently using this but i do not know what to change it to

#!/bin/bash
drives=cat /var/tmp/external_drives_monitor/drives.txt
echo "<result>$drives</result>"
exit0

tkimpton
Valued Contributor II

Apologies. I was being thick

rmanly
Contributor III

XD