Skip to content

Instantly share code, notes, and snippets.

@bonifaido
Created February 2, 2012 12:36
Show Gist options
  • Save bonifaido/1723274 to your computer and use it in GitHub Desktop.
Save bonifaido/1723274 to your computer and use it in GitHub Desktop.
Delete a line from a file with CLI
#!/usr/bin/bash
if [ $# != 2 ] ; then
echo $0 [FILE] [LINENUMBER]
fi
{ rm $1 && awk '{ if (NR != DEL) print }' DEL=$2 > $1; } < $1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment