i want to split the first colum into 2 columns seperating first 10 bits as column 1 and then remainnig as column 2 and retain the remaining columns as it is.
i am doing this becoz i want to modify the first column and after modification i want to merge again.
So is it possible to first split the 1st column into 2 and then after my modification merge them again?
So if i need this to happen,I need to replace the entries of this format
PH01 by string in first column directly
but if i do it
the entries of
PH01278028G0010 will become string 278028G0001 as per my requirement
but my entries of
PH01000000G0240 will look like string000000G0240 which i want as string0G0240
so i thought i will split from 10 bits n do selective replace only on the first column
Is my approach too run around the situation?
thanks between for your feedback!!
siya,
Your description of what you are trying to do is not at all clear. Looking at the "required result" in message #4 in this thread, I'm guessing that you want to replace PH01 immediately followed by up to four zeros with string . If that is what you want, the following awk script will do that for you:
I want to basically convert ONLY the first column of my entire sequence
from
[
B]PH01000000G0240 to string0G0240
PH01000001G0190 to string1G0190
PH01000002G0120 to string2G0120
,....
....
PH01270000G0010 to string270000G0010
PH01278028G0014 to string278028G0014
PH012781040010 to string278104G0010
With respect to code,why does it have {0,4 }in initial part?
I dint understand the part in code : awk 'match($1, /^PH010{0,4}/)
Please do advise.
Thanks:confused:
Apparently my script didn't work for you. That is because you won't describe in English the transformation that is to be performed. I explained in my last post what the script I gave you would do. And, it made all of the transformations your 5 examples showed.
But, it will not insert the G shown in red in your new example. That G did not appear at all in the 1st string whether or not we would break it into an initial 10 character field and a 2nd field with the remaining characters, or left it as a single field.
PLEASE explain in English what you are trying to do instead of giving a small set of inconsistent examples!