04-16-2008
how to print script output to screen and file
Hi all,
I have a script that bulk loads thousands of lines of data. I need to log the output during the execution of the script.
I know I can redirect (">") the output to a file; however, I want the output going to both the screen and the log file.
I thought I could use pipe to pipe the output to a new file but its not working.
For example:
ksh LoadAll.sh > Load.log --> writes only to log
ksh LoadAll.sh | Load.log --> command error
anyone know how this can be done?
thanks
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I did a search for this topic but I couldn't find it and I was sure I have seen something similar before (hard because I am not sure of the criteria for the keywords)
What I was looking for was to be able to echo a message to the screen from a bash.sh script at the same time logging it to a... (2 Replies)
Discussion started by: Shakey21
2 Replies
2. Shell Programming and Scripting
Hello all!..
does anyone know the syntax to print to the screen and to a file?
Im using something like
AWK ....
print header |tee -a invalid_csv_file ;
END {..}
' invalid_csv_file="$invalid_csv_dir_file"
but no joy?
I get sh:... (2 Replies)
Discussion started by: satnamx
2 Replies
3. Shell Programming and Scripting
as the title suggests, i need to print a user message to a log file and the screen using perl.
in unix i set up a function using 'tee' like so
function Display_Message
{
echo "$*" | tee -ai $LOGFILE
}
the following command then obviously displays to the screen and prints to a log... (6 Replies)
Discussion started by: mjays
6 Replies
4. Shell Programming and Scripting
suppose if u have a file like that
Hen ABCCSGSGSGJJJJK 15
Cock ABCCSGGGSGIJJJL 15
* * * * * * : * * * . * * * :
Hen CFCDFCSDFCDERTF 30
Cock CHCDFCSDHCDEGFI 30
* . * * * * * * * : * * :* : : .
The output shud be
where there is : and .
It shud... (4 Replies)
Discussion started by: cdfd123
4 Replies
5. Shell Programming and Scripting
hey guys, I have two files both with two columns, I have already created an
awk code to ignore certain lines (e.g lines that start with 963) as they wou
ld begin with a certain string, however, the rest I have added together and
calculated the average.
At the moment the code also displays... (3 Replies)
Discussion started by: chlfc
3 Replies
6. UNIX for Advanced & Expert Users
All,
PLease can you help me with a shell script which can compare two xml files and print the difference to a output file.
I have attached one such file for you reference.
<Group>
<Member ID=":Year_Quad:41501" childCount="4" fullPath="PEPSICO Year-Quad-Wk : FOLDER.52 Weeks Ending Dec... (2 Replies)
Discussion started by: kanthrajgowda
2 Replies
7. Programming
I am not sure where to post this other than here.
I am trying to figure out why an app gives different output when compiled under Ubuntu 10.10 and CentOS 5.5. I am pretty sure that the issue is that the Cent version has gcc 4.1 installed, while Ubuntu has gcc 4.4. I am trying to print from some... (20 Replies)
Discussion started by: LMHmedchem
20 Replies
8. Shell Programming and Scripting
Hi All,
I have around 900 Select Sql's which I would like to run in an awk script and print the output of those sql's in an txt file.
Can you anyone pls let me know how do I do it and execute the awk script? Thanks. (4 Replies)
Discussion started by: adept
4 Replies
9. Shell Programming and Scripting
Hi All,
I am working on nawk script, has the small function which prints the output on the screen.Am trying to print/append the same output in a file.
Basically nawk script should print the output on the console/screen and as well it should write/append the same result to a file.
script :... (3 Replies)
Discussion started by: Optimus81
3 Replies
10. Shell Programming and Scripting
Hi,
I am trying to capture logs of the script in the file as well as on the screen. I have used exec and tee command for this. While using exec command I am getting the correct output in the file but, script output is not getting displayed on the screen as it get executed.
Below is my sample... (14 Replies)
Discussion started by: Prathmesh
14 Replies