Mar 9, 2007 #1 ogniemi Technical User Joined Nov 7, 2003 Messages 1,041 Location PL ASSSFDSF SDFSGDSFGS SDFSGSFSS SFDSFSFSF SDFSFSFS I am looking for a quick way to process above and get output: AS-SSFDSF SD-FSGDSFGS SD-FSGSFSS SF-DSFSFSF SD-FSFSFS thank you in advance.
ASSSFDSF SDFSGDSFGS SDFSGSFSS SFDSFSFSF SDFSFSFS I am looking for a quick way to process above and get output: AS-SSFDSF SD-FSGDSFGS SD-FSGSFSS SF-DSFSFSF SD-FSFSFS thank you in advance.
Mar 9, 2007 1 #2 feherke Programmer Joined Aug 5, 2002 Messages 9,541 Location RO Hi Code: awk '{sub(/../,"&-")}1' /input/file [gray]# or[/gray] awk '{print substr($0,1,2)"-"substr($0,3)}' /input/file [gray]# or gawk only[/gray] awk '{print gensub(/(..)/,"\\1-","")}' /input/file Feherke. http://rootshell.be/~feherke/ Upvote 0 Downvote
Hi Code: awk '{sub(/../,"&-")}1' /input/file [gray]# or[/gray] awk '{print substr($0,1,2)"-"substr($0,3)}' /input/file [gray]# or gawk only[/gray] awk '{print gensub(/(..)/,"\\1-","")}' /input/file Feherke. http://rootshell.be/~feherke/
Mar 9, 2007 1 #3 PHV MIS Joined Nov 8, 2002 Messages 53,708 Location FR One way: sed 's!^\(..\)!\1-!' /path/to/input > output OOps, awk forum: awk '{print substr($0,1,2)"-"substr($0,3)}' /path/to/input > output Hope This Helps, PH. Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886 Upvote 0 Downvote
One way: sed 's!^\(..\)!\1-!' /path/to/input > output OOps, awk forum: awk '{print substr($0,1,2)"-"substr($0,3)}' /path/to/input > output Hope This Helps, PH. Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886