Windows batch script

Reply

Join Date: Jun 2009
Posts: 9
Reputation: codester is an unknown quantity at this point 
Solved Threads: 0
codester codester is offline Offline
Newbie Poster

Re: Windows batch script

 
0
  #11
Jun 28th, 2009
I am able to do commands such as ls and pwd so I can perform some unix commands, but I don't have GnyWin32 in the path. Do I need to download Coreutils?
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 3,141
Reputation: sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of 
Solved Threads: 555
Sponsor
sknake's Avatar
sknake sknake is offline Offline
.NET Enthusiast

Re: Windows batch script

 
0
  #12
Jun 29th, 2009
You're using bash in cygwin but saying a windows batch file would be preferable but exploring adding coreutils... what language can this be in? I'm afraid you're out of luck when it comes to a .BAT file unless you can hunt down those guys who made as400 batch files... they did things I didn't know DOS was capable of.

Is a bash script an acceptable solution?
Scott Knake
Custom Software Development
Apex Software, Inc.
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 49
Reputation: onaclov2000 is an unknown quantity at this point 
Solved Threads: 5
onaclov2000 onaclov2000 is offline Offline
Light Poster

Re: Windows batch script

 
0
  #13
Jul 6th, 2009
If you have perl, this would be a simple program to come up with.....you can just grab all .txt files, then open each of them, and read it in print out as needed, and once you see for example 2 blank lines, stop getting data.....
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 9
Reputation: codester is an unknown quantity at this point 
Solved Threads: 0
codester codester is offline Offline
Newbie Poster

Re: Windows batch script

 
0
  #14
Aug 23rd, 2009
Sorry I didn't get back sooner, The shell is BASH. It was suggested to use ADO instead, any thoughts?
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 9
Reputation: codester is an unknown quantity at this point 
Solved Threads: 0
codester codester is offline Offline
Newbie Poster

Re: Windows batch script

 
0
  #15
Aug 23rd, 2009
What I forgot to mention is that I need to read in the numbers at the end of each line. They represent percentages so the values can vary.
EX: 100.00,0.00,0.00,good
Last edited by codester; Aug 23rd, 2009 at 4:39 pm.
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 9
Reputation: codester is an unknown quantity at this point 
Solved Threads: 0
codester codester is offline Offline
Newbie Poster

Re: Windows batch script

 
0
  #16
Aug 23rd, 2009
I came up with a vb script that reads in the data but doesn't stop at the blank line of the input. Also every thing is put into the first cell of each row.
The typical line will have the following: What is in the () would be the in the 2nd cell of each row of the csv file, I want to eleminate the dashes anf the words "Functional Aggregate". The other issue is that some rows may have the "Functional Aggregate" and the AAAAA026 switched around.
AAAUSA-0057 (AAAA CCCC) - AAAAA026 - Functional Aggregate,100.00,0.00,0.00,good

The output needs to look like the following:
AAAUSA-0057" "AAAA CCCC" "AAAAA026" "100.00" "0.00" "0.00"
this would be cells A1 - A6 and so on.

This is the VBS code I have so far.

Const xlGeneralFormat = 1
Const xlNormal = -4143
Const xlLastCell = 5

Dim sFiNa
Dim oFS
Dim oExcel
Dim oWBook
Dim sTmp

' Text file to work with

sFiNa = "FunBusAgg"

Set oFS = CreateObject( "Scripting.FileSystemObject" )
sFiNa = oFS.GetAbsolutePathName( sFiNa )
Set oExcel = CreateObject( "Excel.Application")

oExcel.Visible = True
' oExcel.Whatever = False

sTmp = "Working with MS Excel Vers. " & oExcel.Version _
& " (" & oExcel.Workbooks.Count & " Workbooks)"

oExcel.Workbooks.Open sFiNa, xlGeneralFormat
Set oWBook = oExcel.Workbooks( 1 )

' oExcel.Range(oExcel.cells(1,1),oExcel.cells(100,1)).Select
oExcel.Range( oExcel.cells( 1, 1 ) _
, oExcel.cells( oWBook.Sheets( 1 ).UsedRange.SpecialCells( xlLastCell ).Row , 1 ) _
).Select
oExcel.Selection.TextToColumns oExcel.Range("A1"), xlGeneralFormat

' save as XLS
oWBook.SaveAs sFiNa + ".csv", xlNormal


' oWBook.Close
' oExcel.Quit
Last edited by codester; Aug 23rd, 2009 at 6:40 pm.
Reply With Quote Quick reply to this message  
Reply

Message:



Similar Threads
Other Threads in the Shell Scripting Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC