perl - Is there a easier way to edit these lines -


i have these lines in text files appearing

>scrt2_dbd_nngcaacaggtgn 0.455331585111  0.0458438972816 0.145508011584  0.353316506023 0.173692317806  0.0247846149283 0.759302422526  0.0422206447403 1.16863332073e-07       0.940983666713  1.16863332073e-07       0.0590160995601 0.00506737765087        7.91765386614e-08       0.988123281671  0.00680926150142 0.0623177863824 0.93243216705   0.000777853090471       0.00447219347766 0.00453077729507        0.995469025719  9.8493017436e-08        9.8493017436e-08 0.507583592195  0.453364643178  0.0180440139317 0.0210077506946 >snai2_dbd_nrcaggtgn 0.455331585111  0.0458438972816 0.145508011584  0.353316506023 0.173692317806  0.0247846149283 0.759302422526  0.0422206447403 >sp1_dbd_gccmcgcccmc 0.455331585111  0.0458438972816 0.145508011584  0.353316506023 0.173692317806  0.0247846149283 0.759302422526  0.0422206447403 1.16863332073e-07       0.940983666713  1.16863332073e-07       0.0590160995601 0.00506737765087        7.91765386614e-08       0.988123281671  0.00680926150142 0.0623177863824 0.93243216705   0.000777853090471       0.00447219347766 0.00453077729507        0.995469025719  9.8493017436e-08        9.8493017436e-08 0.507583592195  0.453364643178  0.0180440139317 0.0210077506946 

and want this:

>m_scrt2 0.455331585111  0.0458438972816 0.145508011584  0.353316506023 0.173692317806  0.0247846149283 0.759302422526  0.0422206447403 1.16863332073e-07       0.940983666713  1.16863332073e-07       0.0590160995601 0.00506737765087        7.91765386614e-08       0.988123281671  0.00680926150142 0.0623177863824 0.93243216705   0.000777853090471       0.00447219347766 0.00453077729507        0.995469025719  9.8493017436e-08        9.8493017436e-08 0.507583592195  0.453364643178  0.0180440139317 0.0210077506946 >m_snai2 0.455331585111  0.0458438972816 0.145508011584  0.353316506023 0.173692317806  0.0247846149283 0.759302422526  0.0422206447403 >m_sp1 0.455331585111  0.0458438972816 0.145508011584  0.353316506023 0.173692317806  0.0247846149283 0.759302422526  0.0422206447403 1.16863332073e-07       0.940983666713  1.16863332073e-07       0.0590160995601 0.00506737765087        7.91765386614e-08       0.988123281671  0.00680926150142 0.0623177863824 0.93243216705   0.000777853090471       0.00447219347766 0.00453077729507        0.995469025719  9.8493017436e-08        9.8493017436e-08 0.507583592195  0.453364643178  0.0180440139317 0.0210077506946 

i don't want manually, these many.

please aone liner in awk or perl.

you try below sed command,

sed 's/^>\([^_]*\).*$/>m_\1/' file 

example:

$ sed 's/^>\([^_]*\).*$/>m_\1/' file >m_scrt2 >m_snai2 >m_sp1 >m_sp3 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

jsf - How to ajax update an item in the footer of a PrimeFaces dataTable? -

django - CSRF verification failed. Request aborted. CSRF cookie not set -