in reply to Search patern within pattern in a single substitute command
Here's one way:
#! perl -sw use strict; s[(?:\S+ ){2}\K((.).(..))][$2Y$3 $1], print while <DATA>; =output C:\test>junk56 col1 col2 cYl3 col3 col4 col5 1234 5678 9Y12 9012 3456 7890 =cut __DATA__ col1 col2 col3 col4 col5 1234 5678 9012 3456 7890
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Search pattern within pattern in a single substitute command
by toolic (Bishop) on Mar 04, 2011 at 01:37 UTC | |
|
Re^2: Search patern within pattern in a single substitute command
by shobhit (Sexton) on Mar 04, 2011 at 04:57 UTC | |
by BrowserUk (Patriarch) on Mar 04, 2011 at 05:24 UTC | |
by shobhit (Sexton) on Mar 04, 2011 at 05:40 UTC |