May 18, 2012 #1 w5000 Technical User Nov 24, 2010 223 PL hello, example input lines in a file: htrfskjfsfhssflk weoiurweroiljask desired output: htrf-skjf-sfhs-sflk weoi-urwe-roil-jask thank you in advance for some short awk solution!
hello, example input lines in a file: htrfskjfsfhssflk weoiurweroiljask desired output: htrf-skjf-sfhs-sflk weoi-urwe-roil-jask thank you in advance for some short awk solution!
May 18, 2012 Thread starter #2 w5000 Technical User Nov 24, 2010 223 PL ok,thank you -- google already found it. sed 's/..../&-/g;s/-$//' awk '{for(i=1;i<=length($0);i+=4){printf("%s-",substr($0,i,4))}}'|awk '{sub(/-$/,"")};1' Upvote 0 Downvote
ok,thank you -- google already found it. sed 's/..../&-/g;s/-$//' awk '{for(i=1;i<=length($0);i+=4){printf("%s-",substr($0,i,4))}}'|awk '{sub(/-$/,"")};1'