--- Gary Stainburn
On Monday 11 August 2003 9:26 am, Samuel Deakin wrote:
Open Office have given me the soloution the only problem is I need help with the script
You have to copy and edit the file /home/samdea/.sversionrc as well. this is the .severionrc file
[Versions] OpenOffice.org 1.1=file:///home/samdea/OpenOffice.org1.1
** How do I edit the .sversionrc on a big scale e.g I need to put each user names into the "samdea" bit and then copy the file into each home directory plus need to copy the open office directory into each user area**
Sorry if this is off-base as I've just jumped in mid-thread, but couldn't you do something like (not tested):
#!/bin/bash
cd /home for F in *; do if [ -d $F ]; then sed "s/samdea/$F/" $F/.sversionrc fi done
Gary, You need to be careful with the shell globbing technique used above. If there are a lot of users, then it might barf. Since Sam has now ascertained what to do, it is simply a matter og re-writing your shell script :) ------------- #!/bin/sh cd /home for F in * | grep -v samdea; do [ !-e $F/.sversionrc ] && { sed -e "s/samdea/$F/g;" < /some_dir/.sversionrc >$F/.sversionrc } done -------------------------- What this does, is it checks that "$F" doesn't already have the file specified then it'll go ahead, make the substitution and output it to the appropriate new file. To answer your original question, Sam, "sed" is the "Stream EDitor" and allows one to make quick changes to a file by using the concept of "regular expressions". Gary, I have changed your regex slightly, so that the substitiution is done on a global basis to counter for more than one instance. HTH, -- Thomas Adam ===== Thomas Adam "The Linux Weekend Mechanic" -- www.linuxgazette.com ________________________________________________________________________ Want to chat instantly with your online friends? Get the FREE Yahoo! Messenger http://uk.messenger.yahoo.com/