Skip to content

Instantly share code, notes, and snippets.

@opplatek
Created July 21, 2022 16:36
Show Gist options
  • Save opplatek/8a5975c0f5c7740aaf12bb1fe4e34c51 to your computer and use it in GitHub Desktop.
Save opplatek/8a5975c0f5c7740aaf12bb1fe4e34c51 to your computer and use it in GitHub Desktop.
Replace first line in a file (or insert first line)
#!/bin/bash
#
# Replace first line in a file
#
# Insert first line
echo -e "a\nb" | sed '1i transcript_id\tlength'
# Replace - remove and replace first line
echo -e "a\nb" | tail -n+2 | sed '1i transcript_id\tlength'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment