Duplicate output without tee


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Duplicate output without tee
# 1  
Old 01-25-2009
Duplicate output without tee

Hi,
Is there anyway to duplicate output without using tee?

Let me explain the problem.
We are use ssh to login to remote server and save output to a file using tee commands for auditing purposes. When we use vi editor in ssh session, letters get garbled and cant really use vi. Without tee it works fine, but at the same time we need auditing as well.


Your suggestions are appreciated.

Regards
# 2  
Old 01-25-2009
Use the script command.
script audit_save_file

Here "script" will save the session, input and output, to the named file. The script program will run a subshell and you type your commands into the subshell. vi will work, but the saved output will look really screwy.
# 3  
Old 01-26-2009
Duplicate output without tee

Thanks for the reply, that really is a very good option. Though I am not able to totally replace tee with script command.

There are hundreds of users login with this method and their sessions get automatically saved with tee command. I coulnt find a way to replace tee with script command. Can you please suggest?

Thanks in advance.
# 4  
Old 01-26-2009
vi ( and curses based programs ) have a finite list
of "garbage" characters that they print. It shouldn't be
too hard to catalog these and use a sed script to translate
all of those strings to new-lines, or spaces.

For example:

cat audit_file |
sed -e 's/^[[[0-9](;//g' \
-e 's/^[[./s/ /g' \
-e 's/^H//g' \
...

etc...

Where the ESC keys and backspaces are entered into the script
using CONTROL-V.
# 5  
Old 01-26-2009
Duplicate output without tee

Thanks for the reply.

Problem is not with the audit_file, its with the session itself, while in session, we cant use vi if we use tee command to save output to audit_file, without tee it works just fine, but if we dont use tee, we wont have audit_file. Thats why i want a good alternate to tee, like script command, but i am not able to get both things work, which is redirect output to audit_file+terminal session.

Hope this clarifies a bit.

Thanks
# 6  
Old 01-26-2009
I just tried it using typescript and it saved everything just fine . . .
using rlogin though.... not ssh.

vi put the weird characters in the typescript file, but those
are easily removed using the sed solution earlier posted.

I don't think you can get around having to edit out the weird
vi characters.

Another alternative would be to start up typescript within the
users' .profile or .login files once they login.
# 7  
Old 01-26-2009
Thanks for the reply.

I am not worried about the audite_file at all. The problem is with the actual sessions, when user login using this method to a remote server, thats where the problem is, they cant use vi due to the garbled letters.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Mindboggling difference between using "tee" and "/usr/bin/tee" in bash

I'm on Ubuntu 14.04 and I manually updated my coreutils so that "tee" is now on version 8.27 I was running a script using bash where there is some write to pipe error at some point causing the tee command to exit abruptly while the script continues to run. The newer version of tee seems to prevent... (2 Replies)
Discussion started by: stompadon
2 Replies

2. Shell Programming and Scripting

Trying to get rid of a duplicate output line...

Hi folks, I'm trying to work on a script that will grab a router interface report and generate the numbers of "in use" and "un-used" ports per device. Right now, I've got a cut down of the report as follows: sing /usr/apps/siteName/etc/DCAFT-9K.cmds for send text Connecting using... (11 Replies)
Discussion started by: Marc G
11 Replies

3. Shell Programming and Scripting

Duplicate files and output list

Gents, I have a file like this. 1 1 1 2 2 3 2 4 2 5 3 6 3 7 4 8 5 9 I would like to get something like it 1 1 2 2 3 4 5 3 6 7 Thanks in advance for your support :b: (8 Replies)
Discussion started by: jiam912
8 Replies

4. Shell Programming and Scripting

Screen output is blocked by "| tee" command

BACK STORY: I have a script build.py . (It's for creating the ISO file for a special edition of Swift Linux.) This build.py script executes the mintConstructor.py script that I use to modify the Regular Swift Linux ISO to get the special edition Swift Linux ISO. The lines of the script that... (2 Replies)
Discussion started by: swiftlinux
2 Replies

5. Shell Programming and Scripting

how to duplicate an output in shell script

how to duplicate an output from a shell command? for example: `date` will give the current date to the console. I want this to be displayed in console and also parallely store it in file or variable. user1@solaris4:~> date Tue Feb 28 17:48:31 EST 2012 user1@solaris4:~> date > file ... (3 Replies)
Discussion started by: Arun_Linux
3 Replies

6. Shell Programming and Scripting

problem with suppressed output to file using echo and tee command

Hi, When I run the following command in terminal it works. The string TEST is appended to a file silently. echo TEST | tee -a file.txt &>/dev/null However, when I paste this same line to a file, say shell1.sh, and use bourne shell . I run this file in terminal, ./shell1.sh. However I... (1 Reply)
Discussion started by: shahanali
1 Replies

7. UNIX for Dummies Questions & Answers

tee vs output redirection confusion

ok, suppose i have a file called f1 $ cat f1 this is file1 the quick brown fox jumped over the lazy dog this is file1 who let the dogs out this is unix this is file1 and i have another file f2 $ cat f2 this is file2 the task is to eliminate the repeated lines in f1 and add the... (11 Replies)
Discussion started by: c_d
11 Replies

8. Shell Programming and Scripting

How Unix tee to send pipeline output to 2 pipes ?

Hi, I would like to process, filter the same ASCII asynchronous live data stream in more than one pipe pipeline. So the one pipeline should filter out some records using grep key word and more than one pipes pipelines each should grep for another key words, each set seperately for each... (5 Replies)
Discussion started by: jack2
5 Replies

9. Shell Programming and Scripting

log script input and output using tee ?

hi, new to to forum... i've been trying to create a script in tcsh but i'm having a problem with one thing... the script has to keep log of it's input and output so i'm using tee -a log | script | tee -a log this keeps the logs as asked, but it gives me an extra empty prompt (not in the... (0 Replies)
Discussion started by: moseschrist
0 Replies

10. Shell Programming and Scripting

'tee' STDERR output (ksh)

Hi everyone, KSH question: I know you can 'tee' STDOUT to have the output go to multiple targets; can you do the same with STDERR? For example: ls |tee /tmp/file.txt Will redirect STDOUT to both the screen and the '/tmp/file.txt' file. Is there a way of doing the same thing for... (5 Replies)
Discussion started by: gsatch
5 Replies
Login or Register to Ask a Question