Tag Archives: WRITTEN

Script to find line in one file and replace in another

By padgo

Hey Guys, im looking for a script that will work under OSX.

What i want to do is copy information from one file (Specific LIne) and write it to a certain line in another. To be more specific…

I want the hostname of a mac to be gathered ( i assume its stored in a .plist file somewhere) and that hostname value to be written to another pslist file:

The source could be a .plist file

The pslist file that i want it WRITTEN to looks like this:

bgPath
/logo.jpg
defaultBootOS
Mac OS X
linJustification

linuxPartition

mosxJustification
VALUE TO GO HERE

timeLimit
0
title
School of Architecture
userChoosesBootOS

winJustification

windowsPartition
/dev/disk0s3

I have no idea how to do this, any guidance would be appreciated.

Cheers 🙂

Source: FULL ARTICLE at The UNIX and Linux Forums