in reply to Data format - delete parts of string and replace strings that match characters partly with numbers.
For the first part, this should do the job:
perl -pe"s[&[0-9&]+][]g" infile >outfile
For the second part, this might work (assumes the file is comma delimited. Requires a minor change if it is space or tab delimited):
perl -pe"s[,([^,]*HCR.*$][1]; s[,([^,]*LCR.*$][2]; " infile >outfile
|
|---|