Thank you for your reply. This is working fine in shell. However it is my mistake that I did not mention the expected end result completely. I have a file which contains some data with pipe as separator. I need to extract the data from the file and then insert the fields as mentioned above. I am using the following:
Beware: you must concat variable d and $1 because end d is already ";"
Otherwise, technically, it's possible with shell solution but most slow:
Example:
$ echo "Myfile.txt|11671|7824.90|tttt|2822.48|xxx|yyy" | ( IFS=\| read a b c d e f g; echo "$DATETIME$a;$CONTROL;$b;$c;$e")
28-Sep-2013;20:09:08;Myfile.txt;AB;11671;7824.90;2822.48