Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jul 21st, 2004, 9:04 AM   #1
big_k105
PFO Founder

 
big_k105's Avatar
 
Join Date: Mar 2004
Location: Fargo, ND
Posts: 1,630
Rep Power: 10 big_k105 is on a distinguished road
Send a message via AIM to big_k105 Send a message via MSN to big_k105 Send a message via Yahoo to big_k105
ok i have a vb program im writing that sends an argument to our an awk script on one of our linux servers, and then returns a report to my vb program to be displayed. But now i have a problem of getting extra spaces in the page. here is some of the report i get back.

7101088       155gm1b%	0
                INPROCESS
                           88059  278/ 300  162   0 06-23-04 07-16-04 07-12-04
 88543  300/ 300   0   0 07-12-04      08-02-04
 ORDERS
                             UX:sh (sh):                           ERROR                              :                                cnvtmast                            :                                Not found                            
                                ECN FILE /u/in.dt/ecn/melg/eajcyv
                              7101088 copied from 6732801
        6732801
                        |------------------------------------------------------------------------------|
ADVANCED QUALITY PLANNING CHECKLIST:
     Cust:_Bobcat-Gwinner______  Used on model:______________ EAU: __________

and here is what it is suppose to look like, or what it looks like when i just run the awk script from linux and if i put the output into a text file and open it in say textpad or a good text editor.

7101088         155gm1b%    0
INPROCESS
88059  278/ 300  162   0 06-23-04 07-16-04 07-12-04
88543  300/ 300   0   0 07-12-04      08-02-04
ORDERS
  96 04-07-19K BOBCAT-GWN  
  141 04-07-26K BOBCAT-GWN  
  142 04-08-02K BOBCAT-GWN  
   2 04-08-03  BOBCAT-SERV 
  133 04-08-09K BOBCAT-GWN  
ECN FILE /u/in.dt/ecn/melg/eajcyv
               7101088 copied from 6732801
               6732801
|------------------------------------------------------------------------------|
ADVANCED QUALITY PLANNING CHECKLIST:
Cust:_Bobcat-Gwinner______  Used on model:______________ EAU: __________

so my question is how would you go about getting rid of the extra white space. i would normally just write a routine that would remove a certain amount of spaces per line but since the extra spaces in every line isnt the same that wont work. so i was wondering what would be the best way to do this. thanks
__________________
BIG K aka Kyle
Programming Forums
Kyle K Online

Please do not PM or email me programming questions. Post them in the forums instead.
big_k105 is offline   Reply With Quote
Old Jul 21st, 2004, 9:48 AM   #2
Pizentios
Programming Guru
 
Pizentios's Avatar
 
Join Date: May 2004
Location: Brandon, Manitoba, Canada
Posts: 2,023
Rep Power: 7 Pizentios is on a distinguished road
Send a message via ICQ to Pizentios Send a message via MSN to Pizentios
Is there a way that you can just run the awk script and output to a text file, then read it in vb from the text file. Kinda barberic, but it would work.

-Pizentios
__________________
Profanity is the one language that all programmers understand.

Check out my Blog <---updated Nov 30 2007!
Pizentios is offline   Reply With Quote
Old Jul 21st, 2004, 9:49 AM   #3
Pizentios
Programming Guru
 
Pizentios's Avatar
 
Join Date: May 2004
Location: Brandon, Manitoba, Canada
Posts: 2,023
Rep Power: 7 Pizentios is on a distinguished road
Send a message via ICQ to Pizentios Send a message via MSN to Pizentios
Quote:
ERROR : cnvtmast : Not found
could it have somthing to do with this error in the report?
__________________
Profanity is the one language that all programmers understand.

Check out my Blog <---updated Nov 30 2007!
Pizentios is offline   Reply With Quote
Old Jul 21st, 2004, 10:00 AM   #4
big_k105
PFO Founder

 
big_k105's Avatar
 
Join Date: Mar 2004
Location: Fargo, ND
Posts: 1,630
Rep Power: 10 big_k105 is on a distinguished road
Send a message via AIM to big_k105 Send a message via MSN to big_k105 Send a message via Yahoo to big_k105
well i dont think it has anything to do with the error. that is something wrong with the awk script with i call it using vb. but i dont know if that putting the output into a text file first would work because there is still the idea of it being a unix text file and moving it to windows, which messes up the way things are formatted. but i will give it a try
__________________
BIG K aka Kyle
Programming Forums
Kyle K Online

Please do not PM or email me programming questions. Post them in the forums instead.
big_k105 is offline   Reply With Quote
Old Jul 21st, 2004, 10:03 AM   #5
Pizentios
Programming Guru
 
Pizentios's Avatar
 
Join Date: May 2004
Location: Brandon, Manitoba, Canada
Posts: 2,023
Rep Power: 7 Pizentios is on a distinguished road
Send a message via ICQ to Pizentios Send a message via MSN to Pizentios
unix -> windows = no prob
windows-> unix = headache.

windows ->unix != fun.


-Pizentios
__________________
Profanity is the one language that all programmers understand.

Check out my Blog <---updated Nov 30 2007!
Pizentios is offline   Reply With Quote
Old Jul 21st, 2004, 10:14 AM   #6
big_k105
PFO Founder

 
big_k105's Avatar
 
Join Date: Mar 2004
Location: Fargo, ND
Posts: 1,630
Rep Power: 10 big_k105 is on a distinguished road
Send a message via AIM to big_k105 Send a message via MSN to big_k105 Send a message via Yahoo to big_k105
converting a text file so it looks good either way is pretty easy i have writen a text editor that will do that. it will open a unix text file and then read it and make it look good in windows and then when you save it it will convert it back to unix text file it was pretty easy once i knew what i had to do
__________________
BIG K aka Kyle
Programming Forums
Kyle K Online

Please do not PM or email me programming questions. Post them in the forums instead.
big_k105 is offline   Reply With Quote
Old Jul 21st, 2004, 11:22 AM   #7
big_k105
PFO Founder

 
big_k105's Avatar
 
Join Date: Mar 2004
Location: Fargo, ND
Posts: 1,630
Rep Power: 10 big_k105 is on a distinguished road
Send a message via AIM to big_k105 Send a message via MSN to big_k105 Send a message via Yahoo to big_k105
well im making progress this is what i have it printing out now

7101088 155gm1b%	0
 INPROCESS
      88059 278/ 300 162  0 06-23-04 07-16-04 07-12-04
 88543 300/ 300  0  0 07-12-04   08-02-04
 ORDERS
 UX:sh (sh):       ERROR  :  cnvtmast    :  Not found   
        ECN FILE /u/in.dt/ecn/melg/eajcyv
  7101088 copied from 6732801
    6732801
   |------------------------------------------------------------------------------|
   ADVANCED QUALITY PLANNING CHECKLIST:
    Cust:_Bobcat-Gwinner______ Used on model:______________ EAU: __________


this is the current code i am using
Option Explicit
Public strCommand As String
Public s As String

Private Sub Form_Load()
  Dim startpos As Integer, thispos As Integer
  Dim startpos2 As Integer, thispos2 As Integer
  Dim startpos3 As Integer, thispos3 As Integer
  strCommand = "/util/pninfo " + command
  s = sendCommand(strCommand)
  startpos = 1
  Do While True
    thispos = InStr(startpos, s, Chr(10))
    If thispos = 0 Then Exit Do
    s = Left(s, thispos - 1) & Chr(13) & Chr(10) & Mid(s, thispos + 1) ' replace chr(10) with chr(13) & chr(10)
    startpos = thispos + 2
    DoEvents
  Loop
  
  
  Dim strleft As String, strright As String
  startpos2 = 1
  Do While True
    thispos2 = InStr(startpos2, s, Chr(32))
    If thispos2 = 0 Then Exit Do
    strleft = Left(s, thispos2)
    strleft = Trim(strleft)
    s = strleft & " " & Mid(s, thispos2 + 1) 'replaces leading and following spaces
    startpos2 = thispos2 + 2
  Loop
      
  txtReturned.Text = s
End Sub
__________________
BIG K aka Kyle
Programming Forums
Kyle K Online

Please do not PM or email me programming questions. Post them in the forums instead.
big_k105 is offline   Reply With Quote
Old Jul 21st, 2004, 11:39 AM   #8
Pizentios
Programming Guru
 
Pizentios's Avatar
 
Join Date: May 2004
Location: Brandon, Manitoba, Canada
Posts: 2,023
Rep Power: 7 Pizentios is on a distinguished road
Send a message via ICQ to Pizentios Send a message via MSN to Pizentios
That's the output that you read from the text file??
__________________
Profanity is the one language that all programmers understand.

Check out my Blog <---updated Nov 30 2007!
Pizentios is offline   Reply With Quote
Old Jul 21st, 2004, 11:42 AM   #9
big_k105
PFO Founder

 
big_k105's Avatar
 
Join Date: Mar 2004
Location: Fargo, ND
Posts: 1,630
Rep Power: 10 big_k105 is on a distinguished road
Send a message via AIM to big_k105 Send a message via MSN to big_k105 Send a message via Yahoo to big_k105
nope that is the output after using vb to strip the leading and following spaces the code is posted above
__________________
BIG K aka Kyle
Programming Forums
Kyle K Online

Please do not PM or email me programming questions. Post them in the forums instead.
big_k105 is offline   Reply With Quote
Old Jul 21st, 2004, 2:33 PM   #10
Infinite Recursion
Programming Guru
 
Infinite Recursion's Avatar
 
Join Date: Jul 2004
Location: United States
Posts: 3,467
Rep Power: 8 Infinite Recursion is on a distinguished road
Send a message via MSN to Infinite Recursion Send a message via Yahoo to Infinite Recursion
Quote:
run the awk script and output to a text file, then read it in vb from the text file
I probably would have used this approach personally. Let me get to VB when I get home, and I'll take a crack at the problem.
__________________
http://jasonpowers.net

"There are a thousand hacking at the branches of evil to one who is striking at the root."
Infinite Recursion is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 11:31 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC