Community discussions

 
User avatar
ScottReed
Member Candidate
Member Candidate
Topic Author
Posts: 111
Joined: Thu Sep 24, 2009 9:47 pm
Location: Montana / Western Massachusetts

"print" to file truncating results at 80 columns

Fri May 15, 2015 10:51 pm

When running this...
/ip dhcp-server lease print file=dhcp_leases where ! dynamic and status="bound"
The resulting file truncates the output and abruptly ends at column 80.

I have tried via SSH with increased column width. Tried via Winbox terminal. Same results.

If I run the command at the console directly like this...
/ip dhcp-server lease print where ! dynamic and status="bound"
The output is clean and I can copy/paste to my editor.

Anyone know how to get "print" to not truncate at 80 columns? Would be nice because I need to run this command at 35 routers and would like to take a lot of the manual copy/pasting out of the equation! :D
 
scriptinfu
just joined
Posts: 4
Joined: Tue Feb 02, 2016 3:00 pm

Re: "print" to file truncating results at 80 columns

Tue Feb 02, 2016 3:13 pm

I was wondering if you ever found a solution to this bug?
 
scriptinfu
just joined
Posts: 4
Joined: Tue Feb 02, 2016 3:00 pm

Re: "print" to file truncating results at 80 columns

Tue Feb 02, 2016 3:17 pm

When running this...
/ip dhcp-server lease print file=dhcp_leases where ! dynamic and status="bound"
The resulting file truncates the output and abruptly ends at column 80.

I have tried via SSH with increased column width. Tried via Winbox terminal. Same results.

If I run the command at the console directly like this...
/ip dhcp-server lease print where ! dynamic and status="bound"
The output is clean and I can copy/paste to my editor.

Anyone know how to get "print" to not truncate at 80 columns? Would be nice because I need to run this command at 35 routers and would like to take a lot of the manual copy/pasting out of the equation! :D
Has this been resolved?
 
User avatar
ScottReed
Member Candidate
Member Candidate
Topic Author
Posts: 111
Joined: Thu Sep 24, 2009 9:47 pm
Location: Montana / Western Massachusetts

Re: "print" to file truncating results at 80 columns

Thu Feb 04, 2016 3:18 pm

No.
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 5942
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: "print" to file truncating results at 80 columns

Thu Feb 04, 2016 4:11 pm

I assume that you are worried that some of the fields are not visible.?

'print details' outputs all parameters and doe snot truncate anything.
 
User avatar
ScottReed
Member Candidate
Member Candidate
Topic Author
Posts: 111
Joined: Thu Sep 24, 2009 9:47 pm
Location: Montana / Western Massachusetts

Re: "print" to file truncating results at 80 columns

Thu Feb 04, 2016 4:19 pm

I assume that you are worried that some of the fields are not visible.?

'print details' outputs all parameters and doe snot truncate anything.
First, thank you for your reply. It is much appreciated. Unfortunately, that is not the desirable output for this particular case. While 'print detail' does indeed show all the details, it is not in delimited columns for easy copy/paste.

The ultimate goal here is to open the output in Notepad++ (or similar) and then Alt-Select a column and copy for use elsewhere. But when the output is truncated at column 80 it is not very useful.

But, I guess you could run in the terminal:
 /ip dhcp-server lease print without-paging where ! dynamic and status="bound" 
...and then just right-click and Copy All.

That works fine.
 
scriptinfu
just joined
Posts: 4
Joined: Tue Feb 02, 2016 3:00 pm

Re: "print" to file truncating results at 80 columns

Thu Feb 04, 2016 7:08 pm

Hey thanks for the reply! I am still having issues. Here is the output when I use ssh to print:

ssh router.ip /ip dhcp-server lease print without-paging
Flags: X - disabled, R - radius, D - dynamic, B - blocked
# ADDRESS MAC-ADDRESS HO SER.. RA
0 D 255.255.255.255 00:00:00:00:00:00 def..

You can see the information is not correct HO SER.. RA def.. it would be great to get the output the same as when actually logged in. Say if I wanted to print all leases for that moment to a text file using ssh how is the information provided useful?
 
scriptinfu
just joined
Posts: 4
Joined: Tue Feb 02, 2016 3:00 pm

Re: "print" to file truncating results at 80 columns

Thu Feb 04, 2016 7:19 pm

mrz,

It seems your solution works. Thank you.
 
changeip
Forum Guru
Forum Guru
Posts: 3803
Joined: Fri May 28, 2004 5:22 pm

Re: "print" to file truncating results at 80 columns

Sat Feb 06, 2016 6:00 am

This is what you need - very nice feature really.

http://wiki.mikrotik.com/wiki/Manual:Co ... in_process

Just use "admin+120w" as the username instead of "admin".

Sam
Colo and Wholesale Bandwidth Available! Sales at SanDiegoBroadband dot com
 
User avatar
ScottReed
Member Candidate
Member Candidate
Topic Author
Posts: 111
Joined: Thu Sep 24, 2009 9:47 pm
Location: Montana / Western Massachusetts

Re: "print" to file truncating results at 80 columns

Mon Feb 08, 2016 4:04 pm

This is what you need - very nice feature really.

http://wiki.mikrotik.com/wiki/Manual:Co ... in_process

Just use "admin+120w" as the username instead of "admin".

Sam
Thank you, but as stated in my OP, I already tried increasing the terminal width.

It does not fix the issue with "print" truncating at 80w when outputting to a file.
 
User avatar
normis
MikroTik Support
MikroTik Support
Posts: 24268
Joined: Fri May 28, 2004 11:04 am
Location: Riga, Latvia

Re: "print" to file truncating results at 80 columns

Mon Feb 08, 2016 4:06 pm

did you try "print detail" and "print detail without-paging" ?
No answer to your question? How to write posts
 
User avatar
ScottReed
Member Candidate
Member Candidate
Topic Author
Posts: 111
Joined: Thu Sep 24, 2009 9:47 pm
Location: Montana / Western Massachusetts

Re: "print" to file truncating results at 80 columns

Mon Feb 08, 2016 4:41 pm

did you try "print detail" and "print detail without-paging" ?
Normis, thank you so much for your reply.

Yes, I have. That works fine for preserving all the details, but the output is not in selectable columns.

I could write some code to take the "print-details" output and get the data I want, but it seems to me that a standard "print" to a file should preserve the exact same formatting as it shows in the terminal and not truncate at 80 columns.

The point here is that you can take the terminal output of:
/ip dhcp-server lease print without-paging where ! dynamic and status="bound"
And copy/paste it into Notepad++ and then Alt-Select whichever column you want (Address, MAC, HOST, SERVER) etc...

That same command, with output to a file, simply truncates out at 80 columns. It's not helpful because it basically chops the data after the MAC-ADDRESS.

Who is online

Users browsing this forum: No registered users and 9 guests