Commander FAT
2[H]4U
- Joined
- Nov 23, 2000
- Messages
- 3,565
I need a little help at work.
I have to sift through a large amount of text looking for instances of a particular string and then replacing it with a different string. The blocks of text are in no particular form or fashion. It's not standardized and doesn't follow any particular template. It's just blobs of text.
In reality I have to update old circuit IDs with new circuit IDs. There are about 1,400 updates that need to be made.
I have a text file of the old ID in one column with the new ID in a second column.
I'm using Linux and BASH as my terminal.
My first attempt was really sloppy and it didn't work. It consisted of a separate sed for each and every circuit ID replacement. I tried to use a while read loop to make all the changes. Didn't work. Noob move I know. I normally don't code at work. When I do it works but it's usually ugly as sin.
I just need a few hints or clues on the best way to do this.
Thanks
I have to sift through a large amount of text looking for instances of a particular string and then replacing it with a different string. The blocks of text are in no particular form or fashion. It's not standardized and doesn't follow any particular template. It's just blobs of text.
In reality I have to update old circuit IDs with new circuit IDs. There are about 1,400 updates that need to be made.
I have a text file of the old ID in one column with the new ID in a second column.
I'm using Linux and BASH as my terminal.
My first attempt was really sloppy and it didn't work. It consisted of a separate sed for each and every circuit ID replacement. I tried to use a while read loop to make all the changes. Didn't work. Noob move I know. I normally don't code at work. When I do it works but it's usually ugly as sin.
I just need a few hints or clues on the best way to do this.
Thanks