produces...#!/usr/bin/perl use strict; use warnings; my @array = qw ( 0.99 0.99 0.99 0.99 ); my $count = 0; while (<DATA>){ if (/^(\d\.\d{2,3}\s+)x(\s+\d\.\d{2,3})/){ print $1, $array[$count++], $2, "\n" } else { print } } __DATA__ 0.00 x 1.000 0.530 x 0.753 # output values for residue 1 0 # input 0.00 x 1.00 0.555 x 0.683 # output values for residue 2 0
0.00 0.99 1.000 0.530 0.99 0.753 # output values for residue 1 0 # input 0.00 0.99 1.00 0.555 0.99 0.683 # output values for residue 2 0
In reply to Re: replace a column
by wfsp
in thread replace a column
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |