Writing to a file without echo it to the console !!!!


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Writing to a file without echo it to the console !!!!
# 1  
Old 09-01-2008
Writing to a file without echo it to the console !!!!

hi all,

I am trying to write some message to a file using the following command.

echo "${MESSAGE}" >&1 | tee -a ${File_name}

can the same be done without using echo . I don't want the result to be displayed to the console. Can anyone guide me.

Thanks in advance
# 2  
Old 09-01-2008
>I don't want the result to be displayed to the console. ...
So why send it there in the first place? And why are you using tee?
# 3  
Old 09-01-2008
Quote:
Originally Posted by amit_kv1983
hi all,

I am trying to write some message to a file using the following command.

echo "${MESSAGE}" >&1 | tee -a ${File_name}

can the same be done without using echo . I don't want the result to be displayed to the console. Can anyone guide me.

Thanks in advance
If you do not want to echoed out to console, remove the tee option
# 4  
Old 09-01-2008
removing the tee option will still echo the output to console.
Actually my requirement is to write to a file , without using echo. can tll me , if thr is another way to do it ?
# 5  
Old 09-01-2008
What do you think >&1 stands for?
# 6  
Old 09-01-2008
Why can't you just use

Code:
echo "${MESSAGE}"  >>filename

# 7  
Old 09-01-2008
Thanx guys , i was lost to use this one . It's wrking fine nw. Thanks alot
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to read each line from input file, assign variables, and echo to output file?

I've got a file that looks like this (spaces before first entries intentional): 12345650-000005000GL140227 ANNUAL HELC FEE EN 22345650-000005000GL140227 ANNUAL HELC FEE EN 32345650-000005000GL140227 ANNUAL HELC FEE EN I want to read through the file line by line,... (6 Replies)
Discussion started by: Scottie1954
6 Replies

2. Shell Programming and Scripting

[Solved] Writing output to the console

Hi All, I have written one script in which am writting the result to the log file. I want to display the results on the console also if ; then echo "$result doesnot match with the host file">>InputHostsFileErrors.txt else echo "$result input matches with the host... (7 Replies)
Discussion started by: sharsour
7 Replies

3. Shell Programming and Scripting

awk - writing matching pattern to a new file and deleting it from the current file

Hello , I have comma delimited file with over 20 fileds that i need to do some validations on. I have to check if certain fields are null and then write the line containing the null field into a new file and then delete the line from the current file. Can someone tell me how i could go... (2 Replies)
Discussion started by: goddevil
2 Replies

4. Shell Programming and Scripting

Problem with writing to output - awk, echo

Hello all, I wrote this command line for some calculation on my given input files based on another input file which is a txt file. while read BAM REGION; do samtools view $BAM $REGION | awk '{if ($2==0) print $0}' | wc -l >>log.txt; echo "$REGION"; done >> log.txt <regions.txt It takes... (4 Replies)
Discussion started by: @man
4 Replies

5. Shell Programming and Scripting

[Shell/Perl(?)] Prepending timestamps to console output & writing results to a file

I do a lot of TSM work and I embarked on what I thought would be an easy task, and I'd be very happy for any input to save the pounding my keyboard is receiving :] By default, the output of TSM's console has no timestamping, making it hard to sort through accurately. This puts my console into... (5 Replies)
Discussion started by: Vryali
5 Replies

6. Shell Programming and Scripting

Writing html to a file with echo

Hi, I'm having an issue with echo again. I keep getting errors and no file content with these commands in a script. --------------------------------------------------- #!/bin/bash WEBSITE=http://www.google.com touch test1.txt echo "replace("<body>","<body><iframe... (2 Replies)
Discussion started by: digitalviking
2 Replies

7. Shell Programming and Scripting

Output of echo $$ differs in Script than console

Hi All, I have a very basic query for 'echo $$' command. When I am executing echo $$ on console then it is giving different output than the execution of echo $$ in a script. Console Output: ------------------------- bash-3.2$ echo $$ 15610 bash-3.2$ In Script:... (3 Replies)
Discussion started by: manishdivs
3 Replies

8. Shell Programming and Scripting

Searching for Log / Bad file and Reading and writing to a flat file

Need to develop a unix shell script for the below requirement and I need your assistance: 1) search for file.log and file.bad file in a directory and read them 2) pull out "Load_Start_Time", "Data_File_Name", "Error_Type" from log file 4) concatinate each row from bad file as... (3 Replies)
Discussion started by: mlpathir
3 Replies

9. UNIX for Dummies Questions & Answers

Windows to Linux remote console using VNC brings up blank console screen with only mouse pointer

:confused:Hi This was installed on the Linux box a few weeks back by a guy that no longer works for us. All worked fine until last week. Now when we connect its just a blank screen with no icons. I get a whole bunch of errors when starting the service too: Tue Feb 23 14:29:45 2010 ... (1 Reply)
Discussion started by: wbdevilliers
1 Replies

10. Shell Programming and Scripting

Tailing new log file & echo the string on console

Guys, I do have a script that runs to take the server out from network, after running the script it is writing the new log file{outFile} in to directory . Now what i need is my script should tail the last modified file{outFile} & search the string {Server Status} ans should echo the same at the... (0 Replies)
Discussion started by: raghunsi
0 Replies
Login or Register to Ask a Question