Oct 16, 2006 #1 rks11 Technical User Oct 16, 2006 2 DE I would like to be able to modify the following output in filename.txt from this: alpha 56% beta 72% charlie 88% ... to this: alpha 56% beta 72% charlie 88% ... Hope you can help me. Thanks.
I would like to be able to modify the following output in filename.txt from this: alpha 56% beta 72% charlie 88% ... to this: alpha 56% beta 72% charlie 88% ... Hope you can help me. Thanks.
Oct 16, 2006 1 #2 feherke Programmer Aug 5, 2002 9,540 RO Hi Code: awk '{printf $0" ";getline}1' filename.txt Feherke. http://rootshell.be/~feherke/ Upvote 0 Downvote
Oct 16, 2006 3 #3 vgersh99 Programmer Jul 27, 2000 2,146 US Code: nawk '{ORS=(i=!i)?FS:RS}1' a.txt OR nawk 'ORS=(FNR%2)?FS:RS' a.txt vlad +----------------------------+ | #include<disclaimer.h> | +----------------------------+ Upvote 0 Downvote
Code: nawk '{ORS=(i=!i)?FS:RS}1' a.txt OR nawk 'ORS=(FNR%2)?FS:RS' a.txt vlad +----------------------------+ | #include<disclaimer.h> | +----------------------------+
Oct 16, 2006 #4 feherke Programmer Aug 5, 2002 9,540 RO Hi Nice and tricky, vlad. Feherke. http://rootshell.be/~feherke/ Upvote 0 Downvote
Oct 17, 2006 #5 Annihilannic MIS Jun 22, 2000 6,317 AU I have to agree, I was staring at it for quite some time before I understood it. Annihilannic. Upvote 0 Downvote
Oct 17, 2006 #6 PHV MIS Nov 8, 2002 53,708 FR Another simple way: paste -s -d " \n" /path/to/input Hope This Helps, PH. Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886 Upvote 0 Downvote
Another simple way: paste -s -d " \n" /path/to/input Hope This Helps, PH. Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
Oct 17, 2006 Thread starter #7 rks11 Technical User Oct 16, 2006 2 DE Thank you for your assistance Gurus. The following worked perfectly: Code: /usr/xpg4/bin/awk '{printf $0" ";getline}1' filename.txt nawk 'ORS=(FNR%2)?FS:RS' filename.txt paste -s -d " \n" filename.txt Upvote 0 Downvote
Thank you for your assistance Gurus. The following worked perfectly: Code: /usr/xpg4/bin/awk '{printf $0" ";getline}1' filename.txt nawk 'ORS=(FNR%2)?FS:RS' filename.txt paste -s -d " \n" filename.txt