hi Friends,
Please help me to give a try for writing a shell script either with awk or SED for the below requirement.
i have file with 3 lines, each of size 3200 chars, wanted to read this file and divide eachline with 200 columns with differensizes for each column value by keeping seperator.
input:
asdfghjkkkkkkkkkkkkkkkkkkkkkkjjjjjjjjjjjuuuuuuuuuuuuu
zxccvbnmlkjhgfdsaqwertyuioplkjhgfdsaxcvbnmougfds
output:
asdfghjkk|kkkkkkkkkkkkkkkkkkkkjj|jjjjjjjjjuuuuuuuuuuu|uu
zxccvbnm|lkjhgfdsaqwertyuioplkj|hgfdsaxcvbnmougf|ds
what i have tried is as below:
nawk -F\n -f addDelimiter.awk src.txt >tgt.txt
##addDelimiter.awk
printf substring($1,0,9)"|"substring($1,9,20)"|"substring($1,20,20)"|"substring($1,40,2)
it is bailing out error when i ran first, checked open and close paranthesis then i ran next time length of string is too large.
as i told u earlier i took line of size 3200 chars.
please advise on above script.
thanks in advance.
--Bali