I have read the online documentation on the s2p utility, and have tried to run it on my machine without success. The systems guys here do not know what Perl is, unless it has something to do with round, valuable shiny things out of which one could make a necklace, so they are no help—and they might take away Perl entirely if they knew I was fooling around with it. I have tried a number of ways to convert this sed script to Perl, but I finally must admit I need to see a correct version before I go any farther. Would someone please run s2p on this and post the result? Here’s my sed script:
/'1'/{ h d } /'2'/G /'2'/{ h d } /'3'/G /'3'/{ h d } /'4'/G /'4'/{ h d } /'5'/G
All this is doing is swapping one line for the next one if it contains these patterns. I’m trying to get this to work using the pattern of the following script, which works interactively with vi (alas, not Vim—we are so far in the dark ages here at my company, that I might get burned at the stake for mentioning it...) which modifies/ adds lines to a file based on patterns, and otherwise prints the lines just as they were:
#!/usr/bin/perl -w while (<>) { if (/'5'/) { s/[Nn]01/N01(+5) /g; s/'5'/'5';fac=5/g; s/^/NET1TOP BOX (NET);\n/g } etc… print "$_"; }
If someone could just get me started, I would really appreciate it. Thanks.
In reply to sed to perl conversion by NovMonk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |