I am trying to modify my file by using Regex to replcace/substitute strings/numbers:
Example fie:>Sample_1_x80
AGGGGGGGGGTTCCC
>Sample_2_x85
TTTCCCGGGAAAA
>sample_3_x112
GGCCCCTTTGAGG
And I want to modify it to print like so(ID line should be tab-delimited):>ID1 80
AGGGGGGGGGTTCCC
>ID2 85
TTTCCCGGGAAAA
and so on ....
My best effort:
#!usr/bin/perl $file; @files; $filename; $filename = <STDIN>; open(FILENAME, "<$filename") or die "can't open file"; while($file = <FILENAME>){ chomp $file; $file =~ s/sample\_\d\_x?/ID\t/; print $file, "\n"; }
In reply to modifying a file with regex! by rna_follower
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |