I have a huge file whose first line is:
chr start end strand ref_context repeat_masked s1_smpl_context s1_c_count s1_ct_count s1_non_ct_count s1_m% s1_score s1_snp s1_indels s2_smpl_context s2_c_count s2_ct_count s2_non_ct_count s2_m% s2_score s2_snp s2_indels s3_smpl_context s3_c_count s3_ct_count s3_non_ct_count s3_m% s3_score s3_snp s3_indels…
Up to s8.
I want to replace all instances of s1 to s4 with L1 to L4 and then all instances of s5 to s8 with W1 to W4.
Is it best to do this with grep or awk or some other way?
Replace
s[1-4]withL[1-4]ands[5-8]withW[1-4]only on the first line in the file:Demo: