Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Inline Edit -- File name
How will I get the file name when I do an inline edit like this:

perl -i.orig -pe '$_ =3D <filename> $_' filename

How would I get the file name in <filename>?

Thanks,
Rex

Report this thread to moderator Post Follow-up to this message
Old Post
RArul@newenergyassoc.com
09-22-04 08:57 PM


RE: Inline Edit -- File name
Well, I did try that with $ARGV[0], but to no avail. Yes, I had posted a =
POC. Here is the true code that would not print the file-name. What am I =
doing wrong?

perl -pe '$_ =3D "$ARGV[0] \t $_"' trace.txt



-----Original Message-----
From: Jose Alves de Castro [mailto:jac@natura.di.uminho.pt]=20
Sent: Wednesday, September 22, 2004 12:40 PM
To: Arul, Rex
Cc: beginners@perl.org
Subject: Re: Inline Edit -- File name

On Wed, 2004-09-22 at 15:24, RArul@newenergyassoc.com wrote:
> How will I get the file name when I do an inline edit like this:
>=20
> perl -i.orig -pe '$_ =3D <filename> $_' filename

That won't compile, but I believe you're posting something like a proof
of concept rather then code...

If I get this correctly, you're looking for the $ARGV variable. Check
out:

perldoc perlvar

> How would I get the file name in <filename>?
>=20
> Thanks,
> Rex
--=20
Jos=E9 Alves de Castro <cog@cpan.org>
http://natura.di.uminho.pt/~jac


Report this thread to moderator Post Follow-up to this message
Old Post
RArul@newenergyassoc.com
09-23-04 01:58 AM


RE: Inline Edit -- File name
Thanks for the help.=20

This works: perl -pe '$_ =3D "$ARGV \t $_"' trace.txt =20
This doesn't: perl -pe '$_ =3D "$ARGV[0] \t $_"' trace.txt =20

perldoc perlvar says that $ARGV must be used for command-line processors
and in array-context as @ARGV for running scripts.

Thanks, once again.


-----Original Message-----
From: Arul, Rex=20
Sent: Wednesday, September 22, 2004 1:27 PM
To: 'jac@natura.di.uminho.pt'
Cc: beginners@perl.org
Subject: RE: Inline Edit -- File name

Well, I did try that with $ARGV[0], but to no avail. Yes, I had posted a
POC. Here is the true code that would not print the file-name. What am I
doing wrong?

perl -pe '$_ =3D "$ARGV[0] \t $_"' trace.txt

Report this thread to moderator Post Follow-up to this message
Old Post
RArul@newenergyassoc.com
09-23-04 01:58 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PERL Beginners archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 05:20 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.