Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion script help

Received: by 10.224.180.141 with SMTP id bu13mr6709532qab.2.1352502448998;
        Fri, 09 Nov 2012 15:07:28 -0800 (PST)
Received: by 10.236.127.133 with SMTP id d5mr1965326yhi.1.1352502448978; Fri,
 09 Nov 2012 15:07:28 -0800 (PST)
Path: gf5ni18188417qab.0!nntp.google.com!c7no15012375qap.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups: comp.lang.perl.misc
Date: Fri, 9 Nov 2012 15:07:28 -0800 (PST)
In-Reply-To: <0540ec78-bd7a-430a-a6a2-da28e1f14e70@googlegroups.com>
Complaints-To: groups-abuse@google.com
Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=207.98.144.10;
 posting-account=OyGH9gkAAAAg4_Gs9og0GplVokAqVdn_
NNTP-Posting-Host: 207.98.144.10
References: <0540ec78-bd7a-430a-a6a2-da28e1f14e70@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <2e25adcd-f927-42f0-bcc0-11feab15ea42@googlegroups.com>
Subject: Re: script help
From: ccc31807 <carte...@gmail.com>
Injection-Date: Fri, 09 Nov 2012 23:07:28 +0000
Content-Type: text/plain; charset=ISO-8859-1

On Friday, October 19, 2012 5:37:03 PM UTC-4, rvae...@gmail.com wrote:
> I wanted to read a file and select the first 2 characters and if they are 9A or 7A
> I want to zero out columns 18 to 22  and 25 to 29.
> If this can be done in Perl and Bash.
> Can someone assist please. thanks

Assuming that you have some kind of delimited file, you can do it like this (in pseudocode)

open infile
open outfile
while (<infile>)
{
  if(first two characters don't match /[79]A/)
  then write the line to the outfile
  else
    convert the line to an array
    set the array elements [18-22][25-29] to 0
    join the array back to a line
    write the line to the outfile
}
close infile
close outfile