vb.net - Translating row entries to column reading from file -
here working code :
dim commands() = { "stmotd -a {0}", "stmotd -b 15 {0}" } dim objlines = file.readalllines("c:\temp\sobj.txt") 'dim getcount = objlines.length using sw new io.streamwriter("c:\temp\mpadd.txt", true) each line in objlines each cmd in commands sw.writeline(string.format(cmd, line)) next next end using
now "say" sobj.txt file contains following entries"
winmac winppc winvpn
the output i'm getting above code is:
stmotd -a winmac stmotd -b 15 winmac stmotd -a winppc stmotd -b 15 winppc stmotd -a winvpn stmotd -b 15 winvpn
but want output :
stmotd -a winmac winppc winvpn stmotd -b 15 winmac winppc winvpn
i know must easy, in need of here. !
try: (i cannot test code right now-is head)
dim commands() = { "stmotd -a ", "stmotd -b 15 " } dim objlines = file.readalllines("c:\temp\sobj.txt") using sw new io.streamwriter("c:\temp\mpadd.txt", true) each cmd in commands dim com string=cmd each line in objlines com=com & " " & line next sw.writeline(com) next end using
Comments
Post a Comment