Need help in solving "saving result to file"


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Need help in solving "saving result to file"
# 1  
Old 02-14-2005
Need help in solving "saving result to file"

#!/bin/sh

eOutput=$eOutput"Y "

hOutput=$hOutput"NA "

printf "${hOutput}\n${eOutput}\n" > "checkOutput.`date '+%d%b%Y'`"

-----------------
Need some help in solving this mystery please, anyone?
Ok, here is my problem for eOutput and hOutput are strings and i have been appending values into these two strings.

Towards the end of the script, i would want to save the data to file checkOutput with today date but no file is created.. I really need a file to be created....... WHO can help...

If i just print out the sentence, it can print out the value. Why is this so..
printf "${hOutput}\n${eOutput}\n"
# 2  
Old 02-14-2005
frustrated with this forum

anyone to this qns??? I am getting veri frustrated with this forum. Posted two threads. NO replies for both... This forum is really not helpful at alll... Smilie
# 3  
Old 02-14-2005
Kinki,

Please ensure that you read the forum rules - bumping posts in order to gain a quicker response is not permitted.

You must try to understand that people who post at UNIX.com do so on a voluntary basis - contributors receive no recompense for what they do - it's done out of genuine desire to help others whilst at the same time learning more and expanding their own and other visitors knowledge, and providing the finest UNIX knowledge base available.

If somebody can help you, and can spare some of their own time to do so, they will. Nagging posters into giving you assistance is going to have the opposite effect to gaining the help you require - it will make people reluctant to help.

Please be patient.

Thanks,
ZB
# 4  
Old 02-14-2005
valerie, you posted a question at 2:45 in the morning and complained about no response less than 90 minutes later. Then you PM'ed me with this question. Don't PM your questions to moderators, that's not what it's for. Your lack of patience is astounding. And to top it off, this was your only thread without a response. If you need instant support 24 hours a day, you need to buy an expert.

As for your question, I don't see a problem with the code you posted. I put those 4 lines in a script and they ran fine for me. Don't know what to tell you.
# 5  
Old 02-14-2005
I too ran your script and found no problem.
Working for me tooo ...

Try to print the o/p on stdout first ...
# 6  
Old 02-14-2005
Hi..

I ran the script

Quote:
eOutput=$1
hOutput=$2

eOutput=$eOutput"Y "

hOutput=$hOutput"NA "

printf "${hOutput}\n${eOutput}\n" > "checkOutput.`date '+%d%b%Y'`"
and it worked fine from here... Smilie
# 7  
Old 02-15-2005
Hi all,

Apologies for yesterday frustration posted on the thread..

For all who tested the script. I know whats wrong.
1) I printed the script to another file
eg. my script "test.sh"
i execute it with ./test.sh > "hello.txt"
if i just execute ./test.sh. Of course there will be no problem.

2) Then i put the sentences in the script to print another file again. That is why it doesn't work.

eOutput=$1
hOutput=$2

eOutput=$eOutput"Y "

hOutput=$hOutput"NA "

printf "${hOutput}\n${eOutput}\n" > "checkOutput.`date '+%d%b%Y'`"

Hmm, a big headache. Anyone got any suggestion?
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies

2. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

3. Shell Programming and Scripting

finding the strings beween 2 characters "/" & "/" in .txt file

Hi all. I have a .txt file that I need to sort it My file is like: 1- 88 chain0 MASTER (FF-TE) FFFF 1962510 /TCK T FD2TQHVTT1 /jtagc/jtag_instreg/updateinstr_reg_1 dff1 (TI,SO) 2- ... (10 Replies)
Discussion started by: Behrouzx77
10 Replies

4. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

5. Shell Programming and Scripting

"Time" command and save result in a file.txt

Hi, I'am using "time" to check execution time of some script. Is there any possibility to save time command result into a file ? (2 Replies)
Discussion started by: Physix
2 Replies

6. Shell Programming and Scripting

How to distinguish between "command not found" and "command with no result"

system() call imeplemented in solaris is such a way that: Command not found - return code 1 Command executed successfully without Output - return code 1 how to distinguish between these two based on return code in a c - file? Can you help on this ? (5 Replies)
Discussion started by: iitmadhu
5 Replies

7. Shell Programming and Scripting

"sed" to check file size & echo " " to destination file

Hi, I've modified the syslogd source to include a thread that will keep track of a timer(or a timer thread). My intention is to check the file size of /var/log/messages in every one minute & if the size is more than 128KB, do a echo " " > /var/log/messages, so that the file size will be set... (7 Replies)
Discussion started by: jockey007
7 Replies

8. Shell Programming and Scripting

help for saving vertical datas to horizontal with "awk" or "cut"

hi, i have a file having datas like that ./a.txt 12344 12345 12346 12347 ..... ..... ... i want to save this datas to another file like that ./b.txt 12344 12345 12346 12347 ... ... ... i think awk can make this but how? :) waiting for ur help. (3 Replies)
Discussion started by: mercury
3 Replies

9. UNIX for Dummies Questions & Answers

Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`"

Hi Friends, Can any of you explain me about the below line of code? mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'` Im not able to understand, what exactly it is doing :confused: Any help would be useful for me. Lokesha (4 Replies)
Discussion started by: Lokesha
4 Replies
Login or Register to Ask a Question