Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What does this command actually do? 1

Status
Not open for further replies.

grindel

Technical User
Jun 25, 2002
36
0
0
CA

Trying to figger what this actually does, but not having much luck. So, I'll toss it out to you experts:

perl -i~ -nle 'print unless /<(built-in|command line)>/' makefile x2p/makefile

TIA
Rick
 
is this about the command switches? if so:
man perlrun
 
True, you must read the perldocs to truly grasp the power of the command line switches. Perl is a beast when it comes to text file molesting.

Basically your one-liner there is doing an inline edit on a file (inline means it makes a backup of the original file, and then creates a new file in it's place, the new file's content being the output from the one-liner, which in this case will print out every line of the original file MINUS the lines that match the regex. The regex will match lines containing "<built-in>" or "<command line>".

The one-liner is expecting to molest two separate files: 'makefile', and 'x2p/makefile'.

And if I may advise: You don't need the 'l', it adds newlines to the end of print statements, which you should already be present since you are iterating over each line via the 'n' switch.

Hope this hiznelps.

--jim
 
Thanks for the ego-boost arcnon.

"There are two things I promise: one... I will always look this good, and two... I will always be there for you"

That is the only worthwhile quote from hellboy, which otherwise was a cinematic abortion.

--jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top