It is currently Tue, 17 May 2022 17:41:59 GMT



 
Author Message
 Can I redirect this output to a variable?
Hi,
Heres my question.
Can I redirect the output of the awk statement below to a VARIABLE instead
of a FILE?

Heres my script.

#!/bin/sh
echo "Please enter FM number"
read FM
echo "Please enter TO number(s)"
read TO
for i in $TO
   do
   echo $i | awk '/^[1-9]$/ || /^[0-9][0-9]$/ || ^[0-9][0-9][0-9]$/' >>
/tmp/numbers$$
   done
sort -u /tmp/numbers$$ > /tmp/numbers_sorted$$
NUMS=`cat /tmp/numbers_sorted$$`
for j in $NUMS
   do
   cp FILE$FM.DAT FILE$j.DAT
   done
rm /tmp/numbers$$
rm /tmp/numbers_sorted$$

Thanks, Rick



 Tue, 03 Jun 2003 05:50:00 GMT   
 Can I redirect this output to a variable?

Why not? You did just that with the output of the cat
statement 4 lines below the  awk statement, didn't you?
Why do you thing awk is so different from cat?



 Tue, 03 Jun 2003 06:01:23 GMT   
 
   [ 2 post ] 

Similar Threads

1. HELP: redirect the function output to a shell variable

2. Redirecting stderr output to a variable in PERL???

3. Q: Variables - redirecting output

4. Using variables for redirecting output

5. Redirect output using a shell variable??

6. need GDB help redirect command output to variable

7. Formattet output inside variable / line brak inside variable

8. capturing an output variable into a shell variable

9. variable output/variable input

10. Redirecting screen output to a file


 
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software