Hi Guys,
I Need some help Here please.
I have a large file like this:
437493.562 2041538.750 4104.000 0 0 195 1 2FE_04_STALKU_JJHP UNKNOWN JHP TIME Mega_Union_Lit_de_Tabasco_Marino_2012 meters ms
437493.562 2042413.750 3660.000 0 0 195 1 2FE_04_STALKU_JJHP UNKNOWN JHP TIME Mega_Union_Lit_de_Tabasco_Marino_2012 meters ms
437493.562 2043313.750 3048.000 0 0 195 1 2FE_04_STALKU_JJHP UNKNOWN JHP TIME Mega_Union_Lit_de_Tabasco_Marino_2012 meters ms
437493.562 2043963.750 2364.000 0 0 195 1 3FE_04_STALKU_JJHP UNKNOWN JHP TIME Mega_Union_Lit_de_Tabasco_Marino_2012 meters ms
398743.438 2048738.875 1320.000255 230 0 1 1FE_STALKU_JJHP UNKNOWN JHP TIME Mega_Union_Lit_de_Tabasco_Marino_2012 meters ms
398743.438 2047538.875 1740.000255 230 0 1 2FE_STALKU_JJHP UNKNOWN JHP TIME Mega_Union_Lit_de_Tabasco_Marino_2012 meters ms
398743.438 2046438.875 2052.000255 230 0 1 2FE_STALKU_JJHP UNKNOWN JHP TIME Mega_Union_Lit_de_Tabasco_Marino_2012 meters ms
398743.438 2045213.750 2364.000255 230 0 1 2FE_STALKU_JJHP UNKNOWN JHP TIME Mega_Union_Lit_de_Tabasco_Marino_2012 meters ms
I need to add a suffix to the Word between characters 52 to 102 of every line. For example, for line 1 I need to replace FE_04_STALKU_JJHP for FE_04_STALKU_JJHP_MODIF while keeping spacing.
So, my desired output would be:
437493.562 2041538.750 4104.000 0 0 195 1 2FE_04_STALKU_JJHP_MODIF UNKNOWN JHP TIME Mega_Union_Lit_de_Tabasco_Marino_2012 meters ms
437493.562 2042413.750 3660.000 0 0 195 1 2FE_04_STALKU_JJHP_MODIF UNKNOWN JHP TIME Mega_Union_Lit_de_Tabasco_Marino_2012 meters ms
437493.562 2043313.750 3048.000 0 0 195 1 2FE_04_STALKU_JJHP_MODIF UNKNOWN JHP TIME Mega_Union_Lit_de_Tabasco_Marino_2012 meters ms
437493.562 2043963.750 2364.000 0 0 195 1 3FE_04_STALKU_JJHP_MODIF UNKNOWN JHP TIME Mega_Union_Lit_de_Tabasco_Marino_2012 meters ms
398743.438 2048738.875 1320.000255 230 0 1 1FE_STALKU_JJHP_MODIF UNKNOWN JHP TIME Mega_Union_Lit_de_Tabasco_Marino_2012 meters ms
398743.438 2047538.875 1740.000255 230 0 1 2FE_STALKU_JJHP_MODIF UNKNOWN JHP TIME Mega_Union_Lit_de_Tabasco_Marino_2012 meters ms
398743.438 2046438.875 2052.000255 230 0 1 2FE_STALKU_JJHP_MODIF UNKNOWN JHP TIME Mega_Union_Lit_de_Tabasco_Marino_2012 meters ms
398743.438 2045213.750 2364.000255 230 0 1 2FE_STALKU_JJHP_MODIF UNKNOWN JHP TIME Mega_Union_Lit_de_Tabasco_Marino_2012 meters ms
The Problem here is that columns 3 and 4 get together sometimes as you can see in row 5. So, I'm not sure if it's better to try SED, maybe something like:
sed -rni 's/^(.{52})(.* )(.*)/\1\2_MODIF \3/gp' file ( not working ).
Thanks a lot in advance.
I Need some help Here please.
I have a large file like this:
437493.562 2041538.750 4104.000 0 0 195 1 2FE_04_STALKU_JJHP UNKNOWN JHP TIME Mega_Union_Lit_de_Tabasco_Marino_2012 meters ms
437493.562 2042413.750 3660.000 0 0 195 1 2FE_04_STALKU_JJHP UNKNOWN JHP TIME Mega_Union_Lit_de_Tabasco_Marino_2012 meters ms
437493.562 2043313.750 3048.000 0 0 195 1 2FE_04_STALKU_JJHP UNKNOWN JHP TIME Mega_Union_Lit_de_Tabasco_Marino_2012 meters ms
437493.562 2043963.750 2364.000 0 0 195 1 3FE_04_STALKU_JJHP UNKNOWN JHP TIME Mega_Union_Lit_de_Tabasco_Marino_2012 meters ms
398743.438 2048738.875 1320.000255 230 0 1 1FE_STALKU_JJHP UNKNOWN JHP TIME Mega_Union_Lit_de_Tabasco_Marino_2012 meters ms
398743.438 2047538.875 1740.000255 230 0 1 2FE_STALKU_JJHP UNKNOWN JHP TIME Mega_Union_Lit_de_Tabasco_Marino_2012 meters ms
398743.438 2046438.875 2052.000255 230 0 1 2FE_STALKU_JJHP UNKNOWN JHP TIME Mega_Union_Lit_de_Tabasco_Marino_2012 meters ms
398743.438 2045213.750 2364.000255 230 0 1 2FE_STALKU_JJHP UNKNOWN JHP TIME Mega_Union_Lit_de_Tabasco_Marino_2012 meters ms
I need to add a suffix to the Word between characters 52 to 102 of every line. For example, for line 1 I need to replace FE_04_STALKU_JJHP for FE_04_STALKU_JJHP_MODIF while keeping spacing.
So, my desired output would be:
437493.562 2041538.750 4104.000 0 0 195 1 2FE_04_STALKU_JJHP_MODIF UNKNOWN JHP TIME Mega_Union_Lit_de_Tabasco_Marino_2012 meters ms
437493.562 2042413.750 3660.000 0 0 195 1 2FE_04_STALKU_JJHP_MODIF UNKNOWN JHP TIME Mega_Union_Lit_de_Tabasco_Marino_2012 meters ms
437493.562 2043313.750 3048.000 0 0 195 1 2FE_04_STALKU_JJHP_MODIF UNKNOWN JHP TIME Mega_Union_Lit_de_Tabasco_Marino_2012 meters ms
437493.562 2043963.750 2364.000 0 0 195 1 3FE_04_STALKU_JJHP_MODIF UNKNOWN JHP TIME Mega_Union_Lit_de_Tabasco_Marino_2012 meters ms
398743.438 2048738.875 1320.000255 230 0 1 1FE_STALKU_JJHP_MODIF UNKNOWN JHP TIME Mega_Union_Lit_de_Tabasco_Marino_2012 meters ms
398743.438 2047538.875 1740.000255 230 0 1 2FE_STALKU_JJHP_MODIF UNKNOWN JHP TIME Mega_Union_Lit_de_Tabasco_Marino_2012 meters ms
398743.438 2046438.875 2052.000255 230 0 1 2FE_STALKU_JJHP_MODIF UNKNOWN JHP TIME Mega_Union_Lit_de_Tabasco_Marino_2012 meters ms
398743.438 2045213.750 2364.000255 230 0 1 2FE_STALKU_JJHP_MODIF UNKNOWN JHP TIME Mega_Union_Lit_de_Tabasco_Marino_2012 meters ms
The Problem here is that columns 3 and 4 get together sometimes as you can see in row 5. So, I'm not sure if it's better to try SED, maybe something like:
sed -rni 's/^(.{52})(.* )(.*)/\1\2_MODIF \3/gp' file ( not working ).
Thanks a lot in advance.