Skip to content

Instantly share code, notes, and snippets.

@spenserpothier
Last active August 16, 2017 18:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spenserpothier/913401954d46548d4993816adae969c5 to your computer and use it in GitHub Desktop.
Save spenserpothier/913401954d46548d4993816adae969c5 to your computer and use it in GitHub Desktop.
Replace REPLACEME in fileB with the contents of fileA with " " prepended to each line, save to fileC
# Replace REPLACEME in fileB with the contents of fileA with " " prepended to each line, save to fileC
awk 'NR==FNR { a[n++]=" "$0; next }
/REPLACEME/ {for (i=0; i<n; ++i) print a[i]; next }
1' fileA fileB > fileC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment