--- Daniel Falkenberg <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> Below is a chunk of code that I don't really know what's going on?
> Could some one give me a few ideas?
>
> perl -F: -i -ape'$F[3] == 45 && s/^/*/' /etc/passwd
>
> Regards,
>
> Dan
Dan,
Here's a list of the command line switches used and their meaning:
-F(regex) A regular expression to split on if -a is used.
-a Turns on autosplit mode with -n or -p. Splits to @F
-p Assumes an input loop around the script (while(<>){...})
-i Inplace edit if <> is used. (-p)
-e Allows you to execute a single line of script
So... not being a Unix/Linux geek, I'm not sure about the structure of /etc/passwd,
but it appears
that fields in this file are delimited by a colon (which -F will split on) and if the
4th field
($F[3]) is equal to 45, an asterisk will be placed at the beginning of the line
(s/^/*/).
Someone please follow-up if I got any of this wrong.
Cheers,
Curtis "Ovid" Poe
=====
Senior Programmer
Onsite! Technology (http://www.onsitetech.com/)
"Ovid" on http://www.perlmonks.org/
__________________________________________________
Do You Yahoo!?
Find a job, post your resume.
http://careers.yahoo.com
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]