Question: DynamoDB items are currently limited to a 400KB maximum size. When storing items longer than this limit, Amazon [suggests](http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/GuidelinesForItems.html#GuidelinesForItems.StoringInS3) a few options, including splitting long items into multiple items, splitting items across tables, and/or storing large data in S3. 

Sounds OK if nothing ever failed. But what's a recommended approach to deal with making updates and deletes consistent across multiple DynamoDB items plus, just to make things interesting, S3 buckets too?

For a concrete example, imagine an email app with: 

* EmailHeader table in DynamoDB
* EmailBodyChunk table in DynamoDB
* EmailAttachment table in DynamoDB that points to email attachments stored in S3 buckets

Let's say I want to delete an email. What's a good approach to make sure that orphan data will get cleaned up if something goes wrong during the delete operation and data is only partially deleted? (Ideally, it'd be a solution that won't add additional operational complexity like having to temporarily increase the provisioned read limit to run a garbage-collector script.)

Answer: 
Just replace the column with the value required,

```
colno=1
rowno=3

awk -v i=$colno -v j=$rowno  -v newvalue=20 'NR ==j {$i=newvalue}1' file
100 200 300
50 120 200
20 500 340

```

The part, `{$i=newvalue}1` sets the value of `$1`, i.e. from your current example 3rd row and 1st column to the value set in `newvalue`. The `{}1` reconstructs each line based on the individual repalcements.
With GNU sed, to replace at line `$rowno` the `$colno`th occurrence of non space characters with `$newtext` value:

```
sed -E "${rowno}s/[^ ]*( *)/${newtext}\1/${colno}" file    

```