![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| let curl output to stdout AND save to a file | scarfake | Shell Programming and Scripting | 3 | 05-31-2008 04:16 PM |
| getting stderr & stdout output lively modified | teo ramirez | Shell Programming and Scripting | 2 | 10-08-2007 01:06 AM |
| Remote CD woes | greg69 | SUN Solaris | 2 | 08-15-2007 10:52 AM |
| Dual output (stdout and file) | AdrianM | Shell Programming and Scripting | 2 | 03-23-2007 12:35 PM |
| sending syslog output to stderr or stdout | dmirza | UNIX for Advanced & Expert Users | 1 | 10-24-2005 06:41 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
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);
}
I'm a newb. |
|
||||
|
Don't use Perl. Use awk, sed, or Ruby.
Code:
% foo.app | append_semicolon.awk >outfile Code:
#!/usr/bin/nawk -f
{ printf "%s;\n", $0 }
Code:
% foo.app | nawk '{ printf "%s;\n", $0 }' >outfile
Code:
% foo.app | ruby -lne 'print $_,";"' >outfile |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|