Copy the value from Notepad to Excel...

Holiday_Drew

New Member
Joined
Sep 14, 2017
Messages
29
Hi Guys,

ISR2#sh int giga0/1 | i bytes
MTU 1500 bytes, BW 6000 Kbit/sec, DLY 100 usec,
385777 packets input, 35169810 bytes, 0 no buffer
1336499 packets output, 140787372 bytes, 0 underruns
ISR2#sh int gig0/2 | i bytes
MTU 1500 bytes, BW 39000 Kbit/sec, DLY 10 usec,
475461 packets input, 85183562 bytes, 0 no buffer
754342146 packets output, 3691906948 bytes, 0 underruns


Hi guys can you please help me to transfer the 385777 and 1336499 on the excel that is what i need only also the 475461 and 754342146 I need to put this on specific cell but how can I do that I'm a new only on vba can you help me? Please help me thanks :help::help::help:

Thanks
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
assuming you past the data in cell A1.
then try this.

Code:
Sub get_numbers()

lr = Cells(Rows.Count, "A").End(xlUp).Row

For r = 1 To lr
x = Cells(r, "A").Value
If IsNumeric(Left(x, 1)) = True Then Cells(r, "B") = Split(x, " ")(0) Else Cells(r, "B") = ""
Next r
End Sub

hth,

Ross
 
Upvote 0
@rpaulson it just deleted the cell right now Im using this code: It get the wrong information.

ISR2#sh int giga0/1 | i bytes
MTU 1500 bytes, BW 6000 Kbit/sec, DLY 100 usec,
385777 packets input, 35169810 bytes, 0 no buffer
1336499 packets output, 140787372 bytes, 0 underruns
ISR2#sh int gig0/2 | i bytes
MTU 1500 bytes, BW 39000 Kbit/sec, DLY 10 usec,
475461 packets input, 85183562 bytes, 0 no buffer
754342146 packets output, 3691906948 bytes, 0 underruns

@Rick Rothstein Hoping for your help regarding this I already created a post regarding my concern thanks!

I get the data of bytes not the input and output I get 35169810 and 140787372 which is bytes not the input and output I need to get 385777 and 1336499 hope someone can help me thanks
:help: :help: :help:

Code:
Sub Button8_Click() Dim X As Long, B As Long, FileNum As Long
  Dim TotalFile As String, Path As String, Filename As String
  Dim Bytes() As String, Packets() As String, Txt() As String
  Path = "C:\Users\cen00028\Desktop\Andrew\Logging\"
  Filename = Dir$(Path & "*.log")
  Do While Len(Filename)
    FileNum = FreeFile
    Open Path & Filename For Binary As [URL="https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FileNum"]#FileNum[/URL] 
      TotalFile = Space(LOF(FileNum))
      Get [URL="https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FileNum"]#FileNum[/URL] , , TotalFile
    Close [URL="https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FileNum"]#FileNum[/URL] 
    Packets = Split(TotalFile, " packets ", , vbTextCompare)
    ReDim Bytes(1 To UBound(Packets) + 1, 1 To 2)
    B = 0
    For X = 1 To UBound(Packets)
      Txt = Split(Packets(X))
      If Txt(0) = "input," And Not Txt(1) Like "*[!0-9]*" Then
        B = B + 1
        Bytes(B, 1) = Txt(1)
      ElseIf Txt(0) = "output," And Not Txt(1) Like "*[!0-9]*" Then
        Bytes(B, 2) = Txt(1)
      End If
    Next
    Cells(Rows.Count, "E").End(xlUp).Offset(1).Resize(B, 2) = Bytes
    Columns("A:B").AutoFit
    Filename = Dir$
  Loop
End Sub
 
Last edited:
Upvote 0
Hi Guys,

ISR2#sh int giga0/1 | i bytes
MTU 1500 bytes, BW 6000 Kbit/sec, DLY 100 usec,
385777 packets input, 35169810 bytes, 0 no buffer
1336499 packets output, 140787372 bytes, 0 underruns
ISR2#sh int gig0/2 | i bytes
MTU 1500 bytes, BW 39000 Kbit/sec, DLY 10 usec,
475461 packets input, 85183562 bytes, 0 no buffer
754342146 packets output, 3691906948 bytes, 0 underruns
It is not clear from your post where the above data is located. Is all of that in one or two cells (my guess is two cells, but I can't tell for sure)? And which cell or cells are they? And which cell or cells do the numbers go in?
 
Last edited:
Upvote 0
Hi Sir Rick,

The above code is already correct the only problem is I'm getting wrong data. Please see below the wrong data I get:

35169810 and 140787372 is the wrong data this is bytes I need to get the input and output data which is 385777 and 1336499 in the code that I provide the cell are already correct and no problem with the cells go in. This information is located at one text file only. Hoping for your answers thanks!
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,917
Members
452,366
Latest member
TePunaBloke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top