- Joined
- Aug 22, 2011
- Messages
- 3
- Reaction score
- 0
- Points
- 1
Hello all,
I am a developer, and have just got my brand new iMac. I've always used Linux, and the switch has not been particularly hard so far..
However, I have a very simple awk script which I am using as part of an installation procedure, which refuses to work properly. All it does is replace all occurences of a specific string in a text file. The command is:
awk '{ gsub("<OPSPWD>", OPSPATH, $0); print > FILENAME}' OPSPATH=$OPS_PATH $OPS_PATH/somefile.txt
When I run the command, the subtitutions happen correctly but awk places itself in an infinite loop repeating the last 2 lines of the text file. If I use a different output file however (i.e. replace FILENAME with "anotherfile.txt") the commands runs without problems. What is even more strange is that on a couple of other Macs I've had the chance to try this out on the command runs fine.
Has anyone else run into this type of problem before? Does the awk implementation for Mac have any problems in reading and writing back to the same file? Is there a fix? I can't seem to find any info using google on this issue so I decided to register and post here.
I'm using a brand new Intel i5 iMac, OSX v.10.6.8
Thanks very much for any replies,
Antonis
I am a developer, and have just got my brand new iMac. I've always used Linux, and the switch has not been particularly hard so far..
However, I have a very simple awk script which I am using as part of an installation procedure, which refuses to work properly. All it does is replace all occurences of a specific string in a text file. The command is:
awk '{ gsub("<OPSPWD>", OPSPATH, $0); print > FILENAME}' OPSPATH=$OPS_PATH $OPS_PATH/somefile.txt
When I run the command, the subtitutions happen correctly but awk places itself in an infinite loop repeating the last 2 lines of the text file. If I use a different output file however (i.e. replace FILENAME with "anotherfile.txt") the commands runs without problems. What is even more strange is that on a couple of other Macs I've had the chance to try this out on the command runs fine.
Has anyone else run into this type of problem before? Does the awk implementation for Mac have any problems in reading and writing back to the same file? Is there a fix? I can't seem to find any info using google on this issue so I decided to register and post here.
I'm using a brand new Intel i5 iMac, OSX v.10.6.8
Thanks very much for any replies,
Antonis