Simpler Navigation for Servers and Operating Systems
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
General
cancel
Showing results for 
Search instead for 
Did you mean: 

Redirecting 'memlimits' into a file

SOLVED
Go to solution
Michael Steele_2
Honored Contributor

Redirecting 'memlimits' into a file

hello there..

anyone ever try to redirect /usr/sap//SYS/exe/run/memlimits >> outfile?

a) won't redirect
b) output still is written to screen
c) fills outfile with control chars.
d) vi outfile results in 'line too long' error
e) fold -s oufile works but is full of control chars.

comments?

The problem is memlimits won't write to outfile when directed from a script and continues to write to the screen.
Support Fatherhood - Stop Family Law
8 REPLIES
Michael Steele_2
Honored Contributor

Re: Redirecting 'memlimits' into a file

NOTE" Am using STDOUT and STDERR "...>> outfile 2>&1..."
Support Fatherhood - Stop Family Law
A. Clay Stephenson
Acclaimed Contributor

Re: Redirecting 'memlimits' into a file


I suspect that SAP is helping you out by always writing on /dev/tty. It is also possible that they are writing to a file descriptor greater than 2 (stderr); a run under tusc would tell you which file descriptor is being used.

I suggest that you minimize the number of extraneous characters by setting and exporting TERM=dumb.
If it ain't broke, I can fix that.
Michael Steele_2
Honored Contributor

Re: Redirecting 'memlimits' into a file

That helped a great deal in the sense that outfile filled with readable ascii chars top and bottom which provided me with the info I was seeking but still through in a bunch of control chars that I'm going to have to filter out at a latter time.

Thanks again Clay.
Support Fatherhood - Stop Family Law
A. Clay Stephenson
Acclaimed Contributor

Re: Redirecting 'memlimits' into a file

If you set TERM=dumb (and assuming that SAP doesn't have its own terminal database) then you should have very few control-characters. You could pipe the output through this filter to only allow printable ASCII, LF, FF, and through.

memlimits | tr -cd "[ -~\n\t\f]" > outfile
If it ain't broke, I can fix that.
Michael Steele_2
Honored Contributor

Re: Redirecting 'memlimits' into a file

When I try this I get white space, carriage returns and 2 sets of dashed lines. Using : | tr -cd "[ -~\n\t\f]" produced similar results filtering regular expressions like :graph:, :print:, :alnum:, etc.

thanks !
Support Fatherhood - Stop Family Law
Peter Nikitka
Honored Contributor
Solution

Re: Redirecting 'memlimits' into a file

Hi,

you can filter many 'motion escapes' out with col -bx

(see man page).

mfG Peter
The Universe is a pretty big place, it's bigger than anything anyone has ever dreamed of before. So if it's just us, seems like an awful waste of space, right? Jodie Foster in "Contact"
Michael Steele_2
Honored Contributor

Re: Redirecting 'memlimits' into a file

Hey, that worked just fine!

# memlimits | col -bx > outfile

Many Thanks!
Support Fatherhood - Stop Family Law
Michael Steele_2
Honored Contributor

Re: Redirecting 'memlimits' into a file

.
Support Fatherhood - Stop Family Law