Skip to main content
1 of 2
Ed Morton
  • 35.9k
  • 6
  • 25
  • 60

Using GNU awk for "inplace" editing and ARGIND:

awk -i inplace '
    NR == FNR { map[NR]=$2 }
    NR != FNR { sub(/#P#/,map[ARGIND]) }
1' eg.txt ?.txt 
Ed Morton
  • 35.9k
  • 6
  • 25
  • 60