Apr 19, 2004 #1 colsablue Programmer Apr 19, 2004 3 GB Please help - need a quick program to change the 3rd column from whatever to another value, globally - does anyone know how to do this qiuckly? 02 1314 4 100 39 02 1315 4 091 01 1 1 02 1315 4 091 05 549 02 1316 4 091 10 0 3 Thanks
Please help - need a quick program to change the 3rd column from whatever to another value, globally - does anyone know how to do this qiuckly? 02 1314 4 100 39 02 1315 4 091 01 1 1 02 1315 4 091 05 549 02 1316 4 091 10 0 3 Thanks
Apr 19, 2004 #2 vgersh99 Programmer Jul 27, 2000 2,146 US nawk -v col=3 -v new=15 -f colsa.awk colsa.txt #-------- colsa.awk { $col = new; print } vlad +----------------------------+ | #include<disclaimer.h> | +----------------------------+ Upvote 0 Downvote
nawk -v col=3 -v new=15 -f colsa.awk colsa.txt #-------- colsa.awk { $col = new; print } vlad +----------------------------+ | #include<disclaimer.h> | +----------------------------+
Apr 19, 2004 Thread starter #3 colsablue Programmer Apr 19, 2004 3 GB Cheers mate, thanks. Do you know how to do it if the original is had 'tabs' instead of 'spaces' between the columns? Thanks again Upvote 0 Downvote
Cheers mate, thanks. Do you know how to do it if the original is had 'tabs' instead of 'spaces' between the columns? Thanks again
Apr 19, 2004 #4 vgersh99 Programmer Jul 27, 2000 2,146 US nawk -v OFS=$(echo '\t') -v col=3 -v new=15 -f colsa.awk colsa.txt vlad +----------------------------+ | #include<disclaimer.h> | +----------------------------+ Upvote 0 Downvote
nawk -v OFS=$(echo '\t') -v col=3 -v new=15 -f colsa.awk colsa.txt vlad +----------------------------+ | #include<disclaimer.h> | +----------------------------+
Apr 19, 2004 Thread starter #5 colsablue Programmer Apr 19, 2004 3 GB Brilliant - Thankyou ! Upvote 0 Downvote
Apr 19, 2004 #6 futurelet Programmer Mar 3, 2004 539 US Succinct: [tt] awk -f colsa.awk OFS="\t" col=3 new=15 colsa.txt [/tt] Upvote 0 Downvote