There are a number of problems:
  1. At the moment you use tell, you get the position the file pointer is: at the end of the current line. The regexp match does not influence that.
  2. seek takes three arguments, a file pointer (FH), a position to seek to, and an argument which determines how that position should be interpreted: from the beginning of the file, from the end, or from the current position. Your arguments don't make sense.
  3. A sysread advances the filepointer as well. If you want to replace the 10 characters you read, you got to seek 10 positions back before doing your syswrite.
  4. Your $BUF is empty -- shouldn't that contain at least 10 characters?
  5. As the documentation of sysread says: sysread uses unbuffered I/O, don't mix it with buffered. Do not use sysread when you also use <>.
  6. You are trying to open (as a file) anything in the directory, including . and ...

Perhaps the following works for you (untested):

$ perl -0777 -pi -e 's/(SCSI:INQ:80.{94}).{10}/${1}TEST123456/sg' /hom +e/bkirch/PERL_LSN/TICKETS/*

In reply to Re: Changing data with syswrite ? by JavaFan
in thread Changing data with syswrite ? by pbyfire

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.