Quote:
Originally Posted by sam@
... is there a way I could modify the id values as well ...
|
With this InFile ...
Code:
sorce1 LEN assumption 695 3570 0.770047 - . ID=f000001.1;abc
sorce1 LEN descriptive 3334 3570 . - 0 Parent=f000001.1;def
sorce1 LEN extra 913 993 . - 0 Parent=f000001.1;ghi
sorce1 LEN descriptive 695 736 . - 0 Parent=f000001.1;jkl
sorce1 LEN assumption 8859 11328 0.628724 + . ID=f000002.1;mno
sorce1 LEN descrptive 8859 9032 . + 0 Parent=f000002.1;pqr
sorce1 LEN assumption 24331 34483 1 - . ID=f000003.1;stu
sorce1 LEN extra 34479 34483 . - 0 Parent=f000003.1;vwx
... this
awk ...
Code:
awk '{save=$0;
if ($3=="assumption")
{$3="predictive";
$9=substr($9,1,index($9,".")-1) \
substr($9, index($9,".")+2);
print};
print save}' $InFile >$OutFile
... produced this OutFile ...
Code:
sorce1 LEN predictive 695 3570 0.770047 - . ID=f000001;abc
sorce1 LEN assumption 695 3570 0.770047 - . ID=f000001.1;abc
sorce1 LEN descriptive 3334 3570 . - 0 Parent=f000001.1;def
sorce1 LEN extra 913 993 . - 0 Parent=f000001.1;ghi
sorce1 LEN descriptive 695 736 . - 0 Parent=f000001.1;jkl
sorce1 LEN predictive 8859 11328 0.628724 + . ID=f000002;mno
sorce1 LEN assumption 8859 11328 0.628724 + . ID=f000002.1;mno
sorce1 LEN descrptive 8859 9032 . + 0 Parent=f000002.1;pqr
sorce1 LEN predictive 24331 34483 1 - . ID=f000003;stu
sorce1 LEN assumption 24331 34483 1 - . ID=f000003.1;stu
sorce1 LEN extra 34479 34483 . - 0 Parent=f000003.1;vwx
This solution assumes the
ID= field will always be the 9th blank-delimited word.
Daniel B. Martin