Sponsored Content
Full Discussion: Script Output Woes (stdout?)
Top Forums Shell Programming and Scripting Script Output Woes (stdout?) Post 302079337 by c0nn0r on Sunday 9th of July 2006 02:56:41 PM
Old 07-09-2006
Script Output Woes (stdout?)

Hey everyone.

I have been trying a few filtering scripts with both SED and PERL. So far I have both of these versions working to reformat the incoming text stream (from stdin) into the corrent format (it looks good in the terminal), but I don't think that I am doing it right because the formatted text is not available to other applications/operations... but I can see it coming through in the terminal? Is this weird?

this is my setup:

% foo.app | perlFilter.pl

Works great - I can see it in the terminal, but

% foo.app | perlFilter > text

puts nothing into the file text!

% foo.app | perlFilter | nc 127.0.0.1 5001

Shows nothing going through to

nc -l -p 5001

Running nc in verbose mode shows that nothing is going through...

Here is my PERL script:

Code:
#!/usr/bin/perl

while (<>)  {
    $input = $_;
    chomp ($input);
    printf("%s;\n\r", $input);
    }

Do I need to explicitly write out to stdout or something?

I'm a newb.
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

sending syslog output to stderr or stdout

Is there a way to send the syslog output for a given facility to stderr or stdout? I do not want to use the "tail" command to achieve this, I would like it to go directly to stderr. Thanks in advance (1 Reply)
Discussion started by: dmirza
1 Replies

2. Shell Programming and Scripting

Dual output (stdout and file)

Hello everybody, Is there a more elegant way to make dual output (display on standard output and append to a file) while I'm executing a shell script, besides duplicating the echo command for every string? echo "Message..." > 1 echo "Message..." >> myfile.out Thank you for your time,... (2 Replies)
Discussion started by: AdrianM
2 Replies

3. Shell Programming and Scripting

getting stderr & stdout output lively modified

This is about getting all output to stderr and stdout localized. Nothing to do with redirecting output to a file (there already are some interesting threads about that issue on this forum). What I intend to do is capturing all lines of text sent to the screen, compare them with an array of... (2 Replies)
Discussion started by: teo ramirez
2 Replies

4. Shell Programming and Scripting

let curl output to stdout AND save to a file

hello hackers. i have a curl process running as cgi directly pushing stdout to the client. but i want to additionally save that stream to a file at the same time. any directions madly welcome. thanks in advance (3 Replies)
Discussion started by: scarfake
3 Replies

5. Shell Programming and Scripting

Creating an Array in KSH from output (stdout)

Using Cygwin PDksh - But also have tested it on Linux with same results ---- I have a script that invokes a program/script and returns a string of data (1234 "12 34 56" 6789) and using "set -A" inserting it into an array. script code snipit >> get_array=$(php... (2 Replies)
Discussion started by: carlos25
2 Replies

6. Shell Programming and Scripting

Redirecting part of output to stdout

Hi, I am trying to execute a command like this: find ./ -name "*.gz" -exec sh -c 'zcat {} | awk -f parse.awk' \; >> output If I want to print the filename, i generally use the -print argument to the find command but when I am redirecting the output to a file, how can I print just the... (2 Replies)
Discussion started by: Legend986
2 Replies

7. Shell Programming and Scripting

Preserve output order when redirecting stdout and stderr

Hi, I already searched through the forum and tried to find a answer for my problem but I didn't found a full working solution, thats way I start this new thread and hope, some can help out. I wonder that I'm not able to find a working solution for the following scenario: Working in bash I... (8 Replies)
Discussion started by: Boemm
8 Replies

8. Shell Programming and Scripting

File descriptors, redirecting output, and stdout

Hello all. I've been lurking here for a year or two and finally decided to post. I need some assistance with file descriptors, stdout, and redirecting output. I've searched through a number of very helpful threads here (unfortunately I can't link to any of them yet due to my low post count...),... (2 Replies)
Discussion started by: Michael_K
2 Replies

9. Shell Programming and Scripting

Redirecting stdout output to whiptail menu box

As a result of whiptail menu option I am getting a data from a file. Naturally it is output to terminal as stdour. I like to redirect the output back to the menu. It can be done with single input of line of text , see attached. I just cannot see where or how the sample... (0 Replies)
Discussion started by: annacreek
0 Replies

10. UNIX for Beginners Questions & Answers

Output of until to file versus stdout

Why does this until false; do history | head -5; done result in a stdout infinite loop, yet until false; do history | head -5 > hist5; done only writes it once to file hist5? Furthermore, I can hear the hard drive working on the 2nd command until I end the process, but the history | head -5 is... (1 Reply)
Discussion started by: Xubuntu56
1 Replies
Mojo(3pm)						User Contributed Perl Documentation						 Mojo(3pm)

NAME
Mojo - Duct tape for the HTML5 web! SYNOPSIS
use Mojo::Base 'Mojo'; # All the complexities of CGI, PSGI, HTTP and WebSockets get reduced to a # single method call! sub handler { my ($self, $tx) = @_; # Request my $method = $tx->req->method; my $path = $tx->req->url->path; # Response $tx->res->code(200); $tx->res->headers->content_type('text/plain'); $tx->res->body("$method request for $path!"); # Resume transaction $tx->resume; } DESCRIPTION
Mojo provides a flexible runtime environment for Perl real-time web frameworks. It provides all the basic tools and helpers needed to write simple web applications and higher level web frameworks such as Mojolicious. See Mojolicious for more! ATTRIBUTES
Mojo implements the following attributes. "home" my $home = $app->home; $app = $app->home(Mojo::Home->new); The home directory of your application, defaults to a Mojo::Home object which stringifies to the actual path. # Generate portable path relative to home directory my $path = $app->home->rel_file('data/important.txt'); "log" my $log = $app->log; $app = $app->log(Mojo::Log->new); The logging layer of your application, defaults to a Mojo::Log object. # Log debug message $app->log->debug('It works!'); "ua" my $ua = $app->ua; $app = $app->ua(Mojo::UserAgent->new); A full featured HTTP 1.1 user agent for use in your applications, defaults to a Mojo::UserAgent object. Note that this user agent should not be used in plugins, since non-blocking requests that are already in progress will interfere with new blocking ones. # Perform blocking request my $body = $app->ua->get('mojolicio.us')->res->body; METHODS
Mojo inherits all methods from Mojo::Base and implements the following new ones. "new" my $app = Mojo->new; Construct a new Mojo application. Will automatically detect your home directory and set up logging to "log/mojo.log" if there's a "log" directory. "build_tx" my $tx = $app->build_tx; Transaction builder, defaults to building a Mojo::Transaction::HTTP object. "config" my $config = $app->config; my $foo = $app->config('foo'); $app = $app->config({foo => 'bar'}); $app = $app->config(foo => 'bar'); Application configuration. # Manipulate configuration $app->config->{foo} = 'bar'; my $foo = $app->config->{foo}; delete $app->config->{foo}; "handler" $app->handler($tx); The handler is the main entry point to your application or framework and will be called for each new transaction, which will usually be a Mojo::Transaction::HTTP or Mojo::Transaction::WebSocket object. Meant to be overloaded in a subclass. sub handler { my ($self, $tx) = @_; ... } SEE ALSO
Mojolicious, Mojolicious::Guides, <http://mojolicio.us>. perl v5.14.2 2012-09-05 Mojo(3pm)
All times are GMT -4. The time now is 02:02 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy