Log in Sign up
2 Matching Annotations
  1. Jun 2021
  2. unix.stackexchange.com unix.stackexchange.com
    What's the command to "prepend" a line to a file?
    1
    1. TylerRick 23 Jun 2021
      in Public
      text processing: prepend
    Visit annotations in context

    Tags

    • text processing: prepend

    Annotators

    • TylerRick

    URL

    unix.stackexchange.com/questions/56975/whats-the-command-to-prepend-a-line-to-a-file
  3. stackoverflow.com stackoverflow.com
    Prepend text in file
    1
    1. TylerRick 23 Jun 2021
      in Public
      Different ways to prepend a line: (echo 'line to prepend';cat file)|sponge file sed -i '1iline to prepend' file # GNU sed -i '' $'1i\\\nline to prepend\n' file # BSD printf %s\\n 0a 'line to prepend' . w|ed -s file perl -pi -e 'print"line to prepend\n"if$.==1' file
      programming: multiple ways to do the same thing sed text processing: prepend cross-platform differences shell scripting: portability
    Visit annotations in context

    Tags

    • text processing: prepend
    • sed
    • shell scripting: portability
    • programming: multiple ways to do the same thing
    • cross-platform differences

    Annotators

    • TylerRick

    URL

    stackoverflow.com/questions/5150835/prepend-text-in-file
Share:
Group. Only group members will be able to view this annotation.
Only me. No one else will be able to view this annotation.
Hypothes.is
  • About
  • Blog
  • Bioscience
  • Education
  • Jobs
  • Help
  • Contact
  • Terms of Service
  • Privacy Policy