have you considered using sam to break each line into multiple lines and then rejoining. e.g. if you have a | separated record structure, you could do something like:
,x/^.*\n/ { s/\|/\n/g s/\n/\n\n/ } edit the fields, then rejoin before writing it back: ,y/\n\n/ x/\n/ c/|/ ,x/\n\n/ c/\n/ fyi, i'm a casual sam user and there are probably better ways.