943,545 Members | Top Members by Rank

Ad:
You are currently viewing page 2 of this multi-page discussion thread; Jump to the first page
Jun 28th, 2009
0

Re: Windows batch script

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?
Reputation Points: 10
Solved Threads: 0
Newbie Poster
codester is offline Offline
9 posts
since Jun 2009
Jun 29th, 2009
0

Re: Windows batch script

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?
Featured Poster
Reputation Points: 1749
Solved Threads: 735
Senior Poster
sknake is offline Offline
3,948 posts
since Feb 2009
Jul 6th, 2009
0

Re: Windows batch script

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.....
Reputation Points: 11
Solved Threads: 5
Junior Poster in Training
onaclov2000 is offline Offline
57 posts
since Jun 2008
Aug 23rd, 2009
0

Re: Windows batch script

Sorry I didn't get back sooner, The shell is BASH. It was suggested to use ADO instead, any thoughts?
Reputation Points: 10
Solved Threads: 0
Newbie Poster
codester is offline Offline
9 posts
since Jun 2009
Aug 23rd, 2009
0

Re: Windows batch script

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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
codester is offline Offline
9 posts
since Jun 2009
Aug 23rd, 2009
0

Re: Windows batch script

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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
codester is offline Offline
9 posts
since Jun 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Shell Scripting Forum Timeline: EventHandler using Shell script
Next Thread in Shell Scripting Forum Timeline: how to prevent user close window during script execution?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC