Redirecting Output to files 
Author Message
 Redirecting Output to files

Hello all,
    I had a problem redirecting my output (in a print and printf statements)
to files.
    I need to construct a filename from the ARGV[*] variables or from other
variables but
    the only option that worked for me was redirecting my output to constant
literal filenames.
    I need this option to run the same program on different input files and
to get the results in different
    output files (which have meaningful names).

Thank you in advance for any help,

    David Ben-Ami.



Wed, 07 Nov 2001 03:00:00 GMT  
 Redirecting Output to files

% Hello all,
%     I had a problem redirecting my output (in a print and printf statements)
% to files.
%     I need to construct a filename from the ARGV[*] variables or from other
% variables but

If found that some versions of awk don't like things like
 print > var ".txt"
but will work with
 fname = var ".txt"
 print > fname
--

Patrick TJ McPhee
East York  Canada



Wed, 07 Nov 2001 03:00:00 GMT  
 Redirecting Output to files


Quote:


>% Hello all,
>%     I had a problem redirecting my output (in a print and printf statements)
>% to files.
>%     I need to construct a filename from the ARGV[*] variables or from other
>% variables but

>If found that some versions of awk don't like things like
> print > var ".txt"
>but will work with
> fname = var ".txt"
> print > fname

You can usually get away with:

        print > (expression)

(I.e., put the expression in parentheses).  However, you are right in
that unless you are only doing one print to the file, you should
probably put it into a variable and then use that.

I usually find myself doing this:

        print ... > (fn = <complicated expression>)
        print ... > fn
        print ... > fn
        ...
        close(fn)



Thu, 08 Nov 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. expect: redirect output into file called `uname -n'.txt

2. Redirecting output to file with elisp

3. Redirecting to TWO output files

4. Redirecting program output to file

5. how to redirect lpt1 to file-output

6. redirect g77 output into a file under windows xp

7. redirect output of functions to a string or file

8. Redirect file output into variables

9. redirect g77 under DOS 6.22- need output file

10. redirect exec output to a file

11. Redirecting output to a scratch file

12. Redirecting TCL script output to a file

 

 
Powered by phpBB® Forum Software