If you consider posting a question here, you should phrase your questions more carefully, see, for example,
How (Not) To Ask A Question.
I understand your question as follows:
You want to write a Perl snippet that comments the first two of the above lines out by putting a "#" in front of them and then you want the second part surrounded by double quotes and the string "
f(fix,1371) core(60000)" substituted by "
,record(1371)".
You furthermore consider everything after
/apost, including it by itself, the second part of the line.
The code snippet would be:
#!perl -w
use strict;
for (1..2) {
print "# " . <DATA>;
}
while (<DATA>) {
unless (s/(\/apost.*?)(\s*f\(fix,1371\)\s+core\(60000\))(.*$)/"$1,r
+ecord(1371)$3"/) {
s/(\/apost.*$)/"$1"/;
}
print;
}
__DATA__
win-Line<br>
otsort ../data/ABC_DE_WKey_out.dat ../data/ABC_DE_WKey_out.srt /apost
+s(1001,8,c,a) om(1001,1,c,EQ,' ') f(fix,1371) core(60000)<br>
<br>
Unix-Line<br>
otsort ../data/ABC_DE_WKey_out.dat ../data/ABC_DE_WKey_out.srt /apost
+s(1001,8,c,a),om(1001,1,c,EQ,' ') f(fix,1371) core(60000)
When you post here, you should clarify your questions and ask them as precisely as possible. Also, The above is very standard Perl, so that I would recommend you to go to the
Tutorials section.
Hope this helped.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.