Here's a couple of one-liners derived from old scripts:

1) The first one-liner takes care of your case of targeting a single residue or molecule within a larger file.
Note, it's easiest to copy and paste in the string of what you want changed from your .pdb file: 
"BSO4 A 212" for partially occupied B copy of SO4 molecule in chain A at position 212 

So for changing occ from 1.00 to 0.65 it would be:
sed '/BSO4 A 212/s/ 1.00 / 0.65 /' your.pdb > new.pdb 

2) The second is one is when you are in the early stages and want to change large chunks of values, like all HOH's, or all ATOMs or HETATMs.
This requires you to reassemble the whole .pdb file afterward by concatenating the chunks. Beware, it changes everything at the occ position, so if you specify HOH, it will grab all of those in non HETATM records.

For say changing all HETATMs to 0.60 try:
grep ^HETATM your.pdb | awk '{printf("%s\n",substr($0,0,56)"0.60"substr($0,61))}' > new.pdb


Here are the two scripts, note you have to edit them, so takes a few more seconds, but if you are quick with vi, then it's fast. 
I just included them in case you wanted instructions and because I find it easier to find and run them this way, note code differs:

#!/bin/sh
# Copyright © David Shin Jan 25, 2016
# Description: Change occupanies of specified residue
# Modified from: pdb-change-specific-occ
# Usage: Replace <target residue> with residue of choice,
#        Replace <current occ> and <new occ> with correct occupancies
#        Save and run script as:
#        ./pdb-change-occ original.pdb new.pdb
# Example:
#        sed '/<target residue>/s/ <current occ> / <new occ> /' < $1 > $2
#        for changing occ at ILE at position 2 in chain A of 3F7L.pdb, change to:
#        sed '/ILE A   2/s/ 1.00 / 0.65 /g' < $1 > $2
#        then run
#        ./pdb-change-occ 3F7L.pdb 3F7L_mod.pdb
# Updated:
#         Jun 24, 2014 - Mod from pdb-change-bfactor 
#         Jan 25, 2016 - Take care to not overwrite ADP values 1.00 or below
##############

sed '/ILE A   2/s/ 1.00 / 0.65 /' < $1 > $2


---------------


#!/bin/sh
#David Shin
#copyright 2012-02-14
#script changes occ to value in quotes under "occ" below
#additionally, this works on all lines, so uncomment ATOM or HETATM to get desired output
#you can also call for certain residues by changing what's after 'grep'
#usage: pdb-change-all-occ <old.pdb> <new.pdb>

#                                                   " occ"
#grep ^ATOM $1 | awk '{printf("%s\n",substr($0,0,56)"0.60"substr($0,61))}' > $2
grep ^HETATM $1 | awk '{printf("%s\n",substr($0,0,56)"0.60"substr($0,61))}' > $2
grep HOH $1 | awk '{printf("%s\n",substr($0,0,56)"0.99"substr($0,61))}' > $2











On Mon, Jan 25, 2016 at 1:52 AM, david lawson (JIC) <[log in to unmask]> wrote:

Hi Joel,

 

Thanks for your suggestions.

 

I was trying to avoid a manual edit as that gets very tedious when you have many things to change.

 

Dave

 

-------------------------------

 

Dr. David M. Lawson
Department of Biological Chemistry,
John Innes Centre,
Norwich,
NR4 7UH, UK.
Tel: +44-(0)1603-450725
Fax: +44-(0)1603-450018

Email: [log in to unmask]

 

From: Joel Tyndall [mailto:[log in to unmask]]
Sent: 25 January 2016 03:46
To: david lawson (JIC); [log in to unmask]
Subject: RE: quick way to change the occupancies?

 

Or you can edit the pdb file manually.

 

My opinion: I have had issues using refmac when making the occupancy zero where it has disrupted the geometry of the sidechain. I opted for 0.01 occupancy. However now, unless completely necessary, I leave the occupancy at 1.

 

I believe in the scenario 2, Coot adjusts occupancy automatically

 

From: Mailing list for users of COOT Crystallographic Software [mailto:[log in to unmask]] On Behalf Of david lawson (JIC)
Sent: Saturday, 16 January 2016 6:01 AM
To: [log in to unmask]
Subject: quick way to change the occupancies?

 

Dear All,

 

Does anyone have a quick way to change the occupancies of atoms/residues rather than going through the Edit... Residue info... route?

 

I can think of 2 common scenarios where this would be useful (to me at least!):

1.       I want to change the occupancy of a ligand (e.g. to zero, so that it is ignored by refinement). As the ligand could be made up of several residues, a residue range function would be useful.

2.       I have introduced an alternative conformation to a side-chain so that I now need to reduce the occupancy of a water molecule that clashes with this new conformation.

 

Apologies if this is documented somewhere that I have neglected to look.

 

Many thanks in advance,

 

Dave Lawson

 

-------------------------------

 

Dr. David M. Lawson
Department of Biological Chemistry,
John Innes Centre,
Norwich,
NR4 7UH, UK.
Tel: +44-(0)1603-450725
Fax: +44-(0)1603-450018

Email: [log in to unmask]