Your request would be solved formally by for Unix:
perl -i.bak -0777 -lpe 's/\nef\n/\nef\na test content\n<blank line>\n
+/' a.txt
for Windows:
perl -i.bak -0777 -lpe "s/\nef\n/\nef\na test content\n<blank line>\n
+/" a.txt
Addendum: If you only want to insert sth. after a specified line, then you
may get along by doing this:
Unix:
perl -i.bak -pe 'print "a test content\n<blank line>\n" if $.==4' a.t
+xt
Windows:
perl -i.bak -pe "print qq{a test content\n<blank line>\n} if $.==4" a
+.txt
So here we count on $. (line number) and the line after #3 is #4.
Maybe you meant something else by your term "fseek in perl". Better you'd
give a small hint what exactly you are trying to solve by that? Regards mwa
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|