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

Re^3: sed awk to perl help

by Moron (Curate)
on Apr 17, 2007 at 21:29 UTC ( [id://610653]=note: print w/replies, xml ) Need Help??


in reply to Re^2: sed awk to perl help
in thread sed awk to perl help

the -F specifies the split pattern, so instead of also splitting by ' ', just change the -F argument to  -F"[:;\s]"
__________________________________________________________________________________

^M Free your mind!

Key to hats: ^I=white ^B=black ^P=yellow ^E=red ^C=green ^M=blue - see Moron's scratchpad for fuller explanation.

Replies are listed 'Best First'.
Re^4: sed awk to perl help
by dcd (Scribe) on Apr 18, 2007 at 01:50 UTC
    but splitting on spaces too early will change the results from the initial results, plus you won't get the special awk behaviour that you get when you split on <code>' '<\code>
      ok I see what you are doing. I'd have used a regexp without split as many others are suggesting, e.g.:
      perl -F"[:;]" -lane ' print "<a href=mysite.net/$_ >$_</a>" for map { /^\s*(\S+)/; $_ = $1 } @F; '
      Because in the awk you only wanted $1 so don't need to run the regexp more than once per line (line after the -F implied split that is).
      __________________________________________________________________________________

      ^M Free your mind!

      Key to hats: ^I=white ^B=black ^P=yellow ^E=red ^C=green ^M=blue - see Moron's scratchpad for fuller explanation.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (7)
As of 2024-04-23 12:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found