SPUG: How do -aF"\t" in DOS/Windoze?

Tim Maher/CONSULTIX tim at consultix-inc.com
Mon Jul 16 19:42:59 CDT 2001


SPUGsters,

In my "Minimal Perl" tutorial that I'll be debutting at tomorrow night's
SPUG meeting, I try very hard to create the illusion that Perl is really
easy and fun to use, and that it even works on Microsoft platforms! 8-}

So somebody please tell me how to write scripts for the ActivePerl I
downloaded only yesterday to a Win95 box!  Although the "perldoc perlrun"
documentation promises that you can use /, ", or " on the shebang line
to enclose the field-separators for the -F option, none of these works for me.

"perl -wlnaFx" works to make the field-separator x, but nothing more
elaborate works;  I either get a syntax error, or no splitting on the
specified delimiter,  using:

perl -wlnaF'x'
perl -wlnaF"x"
perl -wlnaF/x/
perl -wlnaF\"x\", etc.

Although I was embarrassed, I even tried doubling the quotes,
thinking DOS might be confusing itself with VMS, to no avail:

perl -wlnaF''x''
perl -wlnaF""x""

And once I get that figured out, I'd like to add the -i option, with it's
own argument, which I can't even make work on Linux:

# Trying to "shebangify" following one-liner:
/usr/bin/perl -wlnaF' ' -i'.bak' -e 'print "$F[0]\n"' 

# Here are some attempts, and their errors (OpenLinux 2.2.18; perl 5.6.0)

#! /usr/bin/perl -wlnaF' ' -i'.bak'
Unrecognized file test: -i at s line 1.

#! /usr/bin/perl -wlnaF' ' -i.bak
Unrecognized file test: -i at s line 1.

(Does it think that second argument is the *program* ?)

#! /usr/bin/perl -wlnaF' 'i.bak

Bareword found where operator expected at s line 1, near "' 'i"
	(Missing operator before i?)
Unquoted string "i" may clash with future reserved word at s line 1.
syntax error at s line 1, near "' 'i"
Unquoted string "bak" may clash with future reserved word at s line 1.
Execution of s aborted due to compilation errors.

#! /usr/bin/perl -wlnaF' 'i.bak

This one doesn't generate nay errors, but it doesn't split on <SP> either:
#! /usr/bin/perl -wlnaF/ /i.bak

Can somebody please tell me the correct syntax to a) on Linux, include 
two options on the shebang line that require corresponding arguments,
that might need quoting, and b) on Dos/Windoze, supply a non-printing
( <TAB> )  or special ( \t) character as the argument of -F.

TIA,

-Tim

*==========================================================================*
|  Dr. Tim Maher, CEO, Consultix        (206) 781-UNIX/8649;  ask for FAX# |
|  Email: tim at consultix-inc.com         Web: http://www.consultix-inc.com  |
|  TIM MAHER: Unix/Perl   DAMIAN CONWAY: Adv. Perl   COLIN MEYER: Perl/DBI |
|  Classes! UNIX Fundamentals: 7/23-26; Perl+Mods: 9/17-21; UNIX: 9/24-28  |
*==========================================================================*

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
      Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
 For daily traffic, use spug-list for LIST ;  for weekly, spug-list-digest
  Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/





More information about the spug-list mailing list