| | 56 | }}} |
| | 57 | |
| | 58 | ''If {{{sed}}} scares you, here's a snippet of Python to iterate over a file and replace a string. It does less in 10 lines than {{{sed}}} does in one, but it's easy to drop in other Python scripts. And now I'll go make myself a square wheel... --Rick'' |
| | 59 | |
| | 60 | {{{ |
| | 61 | #!python |
| | 62 | fin = open('RD0033.hierarchy') |
| | 63 | line = fin.readline() |
| | 64 | fout = open('RD0033.hierarchy.new','w') |
| | 65 | while line: |
| | 66 | if line.find('/dsgpfs/harkness/NewL7/Dumps/') != -1: |
| | 67 | line = line.replace('/dsgpfs/harkness/NewL7/Dumps/RD0033/','/gpfs/ux455215/L7/RD0033/') |
| | 68 | fout.write(line) |
| | 69 | line = fin.readline() |
| | 70 | |
| | 71 | fin.close() |
| | 72 | fout.close() |