13

Replacing nth occurrence

view full story
linux-howto

http://www.unix.com – There is already one thread with the same heading. But here the case is little different. i have a line which have a field separator '|' Code: abc|def|ghi|jkl|mno|pqr|stu|vwx|yz I want to replace every 3rd occurance + next character with the same + newline character.. I mean i want to enter a newline character after the next character of the third pipe output should be like this Code: abc|def|ghi|j kl|mno|pqr|s tu|vwx|yz I tried the below command, but using which i cant include the next letter to the 3rd field separator Code: print 'abc|def|ghi|jkl|mno|pqr|s (HowTos)