[H-GEN] Edit massive XML files

home at oranges.id.au home at oranges.id.au
Mon Sep 19 01:19:42 EDT 2011


On 19 September 2011 12:58, Mick <bareman at tpg.com.au> wrote:
> what I'm trying to say (badly it seems) is I want to delete the whole
> line if it begins with
>    <tag k="postal_code"
> regardless of what the rest of the line contains.

As far as I know, sed is fast. Try this:
sed '/tag k="postal_code"/d' inputFile > outputFile

d deletes the line. If you want you to edit the file inline:
sed -i '/tag k="postal_code"/d' inputAndOutputFile

Test before applying - I haven't tested this (: For interest, you
might want to prepend the command (and others) with 'time' to see
which is faster.

HTH,
Greg.

-- 
Gregory Orange



More information about the General mailing list