how to Insert values in multiple lines(records) within a pipe delimited text file in specific cols

this is Korn shell unix.
The scenario is I have a pipe delimited text file which needs to be customized. say for example,I have a pipe delimited text file with 15 columns(| delimited) and 200 rows. currently the 11th and 12th column has null values for all the records(there are other null columns as well). I want to fill the 11 and 12 columns in all the 200 records with <word1> and <word2>. <word1> and <word2> are same for all rows like Copay|Dendrite. Pls help!!
Can this be accomplished using sed or grep patterns.

Thnaks,
Kumar

awk 'BEGIN{FS=OFS="|"}{$11="word1";$12="word2"}1' file
1 Like
perl -F"\|" -plane '@F[10,11]=qw(word1 word2);$_=join"|",@F' your_file

tyler_durden

---------- Post updated at 01:23 AM ---------- Previous update was at 01:11 AM ----------

perl -plane 's/^((.*?\|){10})\|(.*?)$/$1word1|word2$3/' your_file

thanks the awk code works. But the code replaces the header columns also. The very first line in the file is the header containing column names.
The code should ignore the first line and handle the rest of records. how to do that? Sorry I should have been cleared earlier.

awk 'BEGIN{FS=OFS="|"}{$11="word1";$12="word2"}1' file
 

Thanks
Vasanth

awk 'BEGIN{FS=OFS="|"}NR>1{$11="word1";$12="word2"}1' file