[Linux-disciples] help me write a shell script
Jamie Forrest
jamie at honksandsirens.com
Thu Jul 17 11:46:19 EDT 2008
Thanks Steve, I got it all working! If anyone wants to see the final
result, let me know.
Jamie
On Jul 17, 2008, at 11:28 AM, Stephen R Laniel wrote:
> On Thu, Jul 17, 2008 at 11:23:58AM -0400, Jamie Forrest wrote:
>> Is there any way here to modify this to work on stdin rather than a
>> file?
>
> #!/usr/bin/perl
> use strict;
> use warnings;
>
> my $file_contents = join( '', <> );
> $file_contents =~ s#[^[:ascii:]]##gsmi;
> print $file_contents;
>
> So now you can do either
>
> /path/to/myscript.pl filename
>
> or
>
> cat filename | /path/to/myscript.pl
>
> or (it goes without saying)
>
> cat filename | command1 | command2 | \
> command3 | ... | myscript.pl
>
> --
> Stephen R. Laniel
> steve at laniels.org
> Cell: +(617) 308-5571
> http://laniels.org/
> PGP key: http://laniels.org/slaniel.key
> _______________________________________________
> Linux-disciples mailing list
> Linux-disciples at lists.bostoncoop.net
> http://lists.bostoncoop.net/mailman/listinfo/linux-disciples
>
More information about the Linux-disciples
mailing list