| OS X - Development and Darwin Discussion and questions about development for Mac OS X. |
| Post Reply | New Thread | Subscribe |
|
|
Thread Tools |
![]() Member Since: Aug 22, 2011
Posts: 3
![]() |
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 |
| QUOTE Thanks | |
![]() Member Since: Jan 23, 2008
Location: Fort Worth, Texas
Posts: 32,017
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Mac Specs: 21.5" iMac 2.5 GHz i5, iPad 3rd Gen., 3 iPods
|
|
||||
| QUOTE Thanks | |||||
![]() Member Since: Sep 08, 2011
Posts: 1
![]() |
awk <plink.356.assoc '{s += $9} END {print FILENAME,",", s/NR}' It never prints the filename, but only: , 0.510662 However, solved it by doing: awk '{s += $9} END { print FILENAME, s/NR}' plink.356.assoc Cheers, Ida Last edited by i.e.sonderby; 09-08-2011 at 10:22 AM. |
| QUOTE Thanks | |
| Post Reply | New Thread | Subscribe |
| Thread Tools | |
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
|
|||||||
Thread |
Thread Starter |
Forum |
Replies |
Last Post |
| Strange Microsoft/MSN Messenger connection problems | blaine_t | OS X - Operating System | 1 | 03-02-2009 08:30 PM |
| Realtek sound problems, lag problems | Starflame | Running Windows (or anything else) on your Mac | 2 | 11-08-2008 10:54 AM |
| iMac + MacBook MacBookPro Internet Connection Problems | stevend | Internet, Networking, and Wireless | 2 | 10-05-2008 11:19 AM |
| Problems with leopard | an gael cliste | OS X - Operating System | 2 | 09-18-2008 09:37 AM |
| Strange ghost images/display problems | njbrubaker | Switcher Hangout | 3 | 06-05-2006 12:18 PM |
All times are GMT -4. The time now is 10:38 AM.
Powered by vBulletin