sending to txt file


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers sending to txt file
# 1  
Old 04-16-2004
Java unix sending to txt file

i have done this code but am not sure how to send it to a txt file

for i in `w -h | awk '{ print $1 }'| sort | uniq`; do

n=`w -h $i | wc -l`
printf "$i:$n\n"

thanks any help would be great

Last edited by peter112; 04-16-2004 at 10:50 AM..
# 2  
Old 04-16-2004
sh script > file.txt

???
# 3  
Old 04-16-2004
yip

yip i understans that but where in the code do i put it ?

thanks peter
# 4  
Old 04-16-2004
for i in `w -h | awk '{ print $1 }'| sort | uniq`; do

n=`w -h $i | wc -l`
printf "$i:$n\n" > file.txt
done


It's better?
# 5  
Old 04-16-2004
> i have done this code

No, you have not.
And it is the second time you break the rules, this time knowingly.

https://www.unix.com/shell-programming-and-scripting/13504-unix-bourne-shell.html?s=
# 6  
Old 04-16-2004
Peter112,

I hate to be the bad guy here, but your continued posting of homework questions is in direct violation of our site rules...

Forum Rules

(6) Do not post classroom or homework problems.


If you continue to post homework questions we will have no other course but to ban your IP....


Consider this your first warning.


Please let your friends know this as well... related in this other post..

https://www.unix.com/shell-programming-and-scripting/13504-unix-bourne-shell.html?s=

and this one too...

https://www.unix.com/unix-for-dummies-questions-and-answers/13401-unix-help.html?s=
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Desired output.txt for reading txt file using awk?

Dear all, I have a huge txt file (DATA.txt) with the following content . From this txt file, I want the following output using some shell script. Any help is greatly appreciated. Greetings, emily DATA.txt (snippet of the huge text file) 407202849... (2 Replies)
Discussion started by: emily
2 Replies

2. Windows & DOS: Issues & Discussions

2 Questions: replace text in txt file, add text to end of txt file

so... Lets assume I have a text file. The text file contains multiple "#" symbols. I want to replace all thos "#"s with a STRING using DOS/Batch I want to add a certain TEXT to the end of each line. How can I do this WITHOUT aid of sed, grep or anything linux related ? (1 Reply)
Discussion started by: pasc
1 Replies

3. UNIX for Dummies Questions & Answers

Sending mail in UNIX with body and attachment(.txt) using sendmail command

Hi All, In my .ksh script, I am sending an email with body and attachment (.txt) using sendmail command. I am able to receive the attachement along with the body of the mail. But I am getting special characters along with the content in the .txt. Also the alignment is incorrect. Can you please... (7 Replies)
Discussion started by: KRR
7 Replies

4. Shell Programming and Scripting

Need to append the date | abcddate.txt to the first line of my txt file

I want to add/append the info in the following format to my.txt file. 20130702|abcd20130702.txt FN|SN|DOB I tried the below script but it throws me some exceptions. <#!/bin/sh dt = date '+%y%m%d'members; echo $dt+|+members+$dt; /usr/bin/awk -f BEGIN { FS="|"; OFS="|"; } { print... (6 Replies)
Discussion started by: harik1982
6 Replies

5. Shell Programming and Scripting

problem with sending mail from txt file having HTML code via sendmail -t

Hi, i have the following code in shell named as test3.sh.. #!/bin/sh . /home/<user>/.profile export dt=`date "+%d%b%y"` export tim=`date "+%d%b%y %HM:%MM"` cd export WD=`pwd` SID="<sid>" export SID export ORACLE_SID=$SID export ORACLE_HOME=/oracle/$SID/102_64 export... (4 Replies)
Discussion started by: jassi10781
4 Replies

6. Shell Programming and Scripting

awk append fileA.txt to growing file B.txt

This is appending a column. My question is fairly simple. I have a program generating data in a form like so: 1 20 2 22 3 23 4 12 5 43 For ever iteration I'm generating this data. I have the basic idea with cut -f 2 fileA.txt | paste -d >> FileB.txt ???? I want FileB.txt to grow, and... (4 Replies)
Discussion started by: theawknewbie
4 Replies

7. Shell Programming and Scripting

command to list .txt and .TXT file

Hi expersts, in my directory i have *.txt and *.TXT and *.TXT.log, *.txt.log I want list only .txt and .TXT files in one command... how to ?? //purple (1 Reply)
Discussion started by: thepurple
1 Replies

8. UNIX for Dummies Questions & Answers

Binary txt file received when i use uuencode to send txt file as attachment

Hi, I have already read a lot of posts on sending attachments in unix...but none of them were of help for my problem...so here goes.. i wanna attach a text file and send to a mail id..used the following code : uuencode "$File1" "$File1" ;|mail -s "$Mail_sub" abc@abc.com it works... (2 Replies)
Discussion started by: ash22
2 Replies

9. Shell Programming and Scripting

Need to attach a txt file while sending mail

Hi, I need to attach a txt file while sending mail thru Unix. Please help me out in this.. -Charan. (9 Replies)
Discussion started by: charan81
9 Replies
Login or Register to Ask a Question