Just as awk has FILENAME NR FNR like variables Add same feature in sed.Now sed has "F" for filename "=" for line numberBut flaw in sed is that those F and = directky ouyput to stdout. Using debug i found above Rather if F and = result can be made a part of pattern space we can perform many one liners wuthout mulyiple piped commands.Eg. I want 4th line of file prepended with filenzme currently we have to sed '4F' | some more sed command to process to merge Filename line to 4th line. But if F and = output can be made availabk in pattern space.eg 1F would add Filename\n1st line in partten space. or  sed '4s/^/$F/' Juat like awk built in variable we canuse F and = options Sent from Yahoo Mail on Android