Sponsored Content
Top Forums UNIX for Dummies Questions & Answers STDOUT redirect to file and format problems Post 302563237 by edgarvm on Monday 10th of October 2011 12:42:35 PM
Old 10-10-2011
the file you are using seems to be a DOS file, try using dos2unix before proceed
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

problem with redirect stdout to file

Hi all hope you can help as I am going MAD!!! :eek: The below is in a shell script but the redirection in the sed line does not work and outputs to the screen and the $fname_2 does note get created ????? Can any one help ?? #!/bin/ksh cd /app/ for fname in `ls -1 X*` do sed 1d $fname... (3 Replies)
Discussion started by: mlucas
3 Replies

2. UNIX for Advanced & Expert Users

STDOUT redirect to a FILE, when fuser command is used !!

Hi all, I have the following script: ------------------------------------------------- #SCRIPT TO CHECK WHO HAS ACCESSED THE LOG/FILE IN PAST 'N' MINUTES, AND MAIL ACCORDINGLY. MYPATH="/clocal/mqbrkrs/user/mqsiadm/sanjay/" MAIL_RECIPIENTS="vg517@dcx.com" Subject="File accessed in last... (6 Replies)
Discussion started by: varungupta
6 Replies

3. Shell Programming and Scripting

How to redirect stderr and stdout to a file

Hi friends I am facing one problem while redirecting the out of the stderr and stdout to a file let example my problem with a simple example I have a file (say test.sh)in which i run 2 command in the background ps -ef & ls & and now i am run this file and redirect the output to a file... (8 Replies)
Discussion started by: sushantnirwan
8 Replies

4. Shell Programming and Scripting

Redirect stdout/stderr to a file globally

Hi I am not if this is possible: is it possible in bach (or another shell) to redirect GLOBALLY the stdout/stderr channels to a file. So, if I have a script script.sh cmd1 cmd2 cmd3 I want all stdout/stderr goes to a file. I know I can do: ./script.sh 1>file 2>&1 OR ... (2 Replies)
Discussion started by: islegmar
2 Replies

5. Shell Programming and Scripting

Unix file redirect problems

hi, In my script, i wrote a line like this : ls -lrt tpa* > x.xls while executing the script, it showing o/p as "tpa*: No such file or directory" because there is no files starts with tpa* now, instead of server showing this msg, i want my scritpt to display as : "No jobs available which... (15 Replies)
Discussion started by: p_satyambabu
15 Replies

6. Shell Programming and Scripting

redirect STDOUT to a file in a subshell

Hi, I would like to avoid re-directing line by line to a file. What is the best way to re-direct STDOUT to a file in a subshell? Thanks in advance. Cheers Vj (1 Reply)
Discussion started by: tnvee
1 Replies

7. Shell Programming and Scripting

redirect stdout and stderr to file wrong order problem with subshell

Hello I read a lot of post related to this topic, but nothing helped me. :mad: I'm running a ksh script with subshell what processing some ldap command. I need to check output for possible errors. #!/bin/ksh ... readinput < $QCHAT_INPUT |& while read -p line do echo $line ... (3 Replies)
Discussion started by: Osim
3 Replies

8. Shell Programming and Scripting

Redirect STDOUT & STDERR to file and then on screen

Dear all, redirecting STDOUT & STDERR to file is quite simple, I'm currently using: exec 1>>/tmp/tmp.log; exec 2>>/tmp/tmp.logBut during script execution I would like the output come back again to screen, how to do that? Thanks Lucas (4 Replies)
Discussion started by: Lord Spectre
4 Replies

9. Programming

C, UNIX: How to redirect 'stdout' to a file from a C code?

I am looking for a way to redirect standard output to a file from a C-code; so, any 'cout<<..' or 'printf(...)' will be written into a file. I have a server source that I need to debug. That program called by RPC (remote procedure call) and has no any session to print out anything. I have... (3 Replies)
Discussion started by: alex_5161
3 Replies

10. Shell Programming and Scripting

Redirect STDOUT & STDERR to file and then on screen

Dear all, redirecting STDOUT & STDERR to file is quite simple, I'm currently using: Code: exec 1>>/tmp/tmp.log; exec 2>>/tmp/tmp.log But during script execution I would like the output come back again to screen, how to do that? Thanks Luc edit by bakunin: please use CODE-tags like the... (6 Replies)
Discussion started by: tmonk1
6 Replies
Size(3pm)						User Contributed Perl Documentation						 Size(3pm)

NAME
Term::Size - Retrieve terminal size (Unix version) SYNOPSIS
use Term::Size; ($columns, $rows) = Term::Size::chars *STDOUT{IO}; ($x, $y) = Term::Size::pixels; DESCRIPTION
Term::Size is a Perl module which provides a straightforward way to retrieve the terminal size. Both functions take an optional filehandle argument, which defaults to *STDIN{IO}. They both return a list of two values, which are the current width and height, respectively, of the terminal associated with the specified filehandle. "Term::Size::chars" returns the size in units of characters, whereas "Term::Size::pixels" uses units of pixels. In a scalar context, both functions return the first element of the list, that is, the terminal width. The functions may be imported. If you need to pass a filehandle to either of the "Term::Size" functions, beware that the *STDOUT{IO} syntax is only supported in Perl 5.004 and later. If you have an earlier version of Perl, or are interested in backwards compatibility, use *STDOUT instead. EXAMPLES
1. Refuse to run in a too narrow window. use Term::Size; die "Need 80 column screen" if Term::Size::chars *STDOUT{IO} < 80; 2. Track window size changes. use Term::Size 'chars'; my $changed = 1; while(1) { local $SIG{'WINCH'} = sub { $changed = 1 }; if ($changed) { ($cols, $rows) = chars; # Redraw, or whatever. $changed = 0; } } RETURN VALUES
Both functions return "undef" if there is an error. If the terminal size information is not available, the functions will normally return "(0, 0)", but this depends on your system. On character only terminals, "pixels" will normally return "(0, 0)". BUGS
It only works on Unix systems. AUTHOR
Tim Goodwin, <tim@uunet.pipex.com>, 1997-04-23. Candidate for maintainership: Adriano Ferreira, <ferreira@cpan.org>, 2006-05-19. perl v5.14.2 2012-03-04 Size(3pm)
All times are GMT -4. The time now is 03:41 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy