Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: How-To on Perl one-liners

by ikegami (Patriarch)
on Apr 03, 2005 at 22:13 UTC ( [id://444546]=note: print w/replies, xml ) Need Help??


in reply to How-To on Perl one-liners

Perl's not needed here.

From prompt:
for %q in (*.doc) do antiword "%q" > "%~nq.txt"

From batch file:
for %%q in (*.doc) do antiword "%%q" > "%%~nq.txt"

Replies are listed 'Best First'.
Re^2: How-To on Perl one-liners
by willyyam (Priest) on Apr 04, 2005 at 03:42 UTC
    Absolutely true, and thank you for the code. However, I work on several systems, all of which have Perl, but not all of which have a consistent or sane shell. I believe the relevant quote is, "It is easier to port a shell than a shell script." My thinking in asking the question is, if I grok Perl one-liners, I don't need shell scripting nearly as much.
      if I grok Perl one-liners, I don't need shell scripting nearly as much

      Indeed, but with oneliners, you still need to know the shell fairly well. I'm not implying you don't, but I'm just trying to make the point. There are many shell gotchas involved when writing oneliners. Most common are quoting and glob expansion (or expansion in general) woes. Also, it's often more natural to use a perl oneliner as part of the pipeline, rather than the entire thing. This requires knowing the shells you're working with. There's really no [reasonably convenient] way of avoiding it. :-)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://444546]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (7)
As of 2024-04-19 12:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found