Skip to content

Instantly share code, notes, and snippets.

@atemate
Created June 30, 2023 10:57
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 atemate/03a520840182848b9e88e0da395607e9 to your computer and use it in GitHub Desktop.
Save atemate/03a520840182848b9e88e0da395607e9 to your computer and use it in GitHub Desktop.
Replace first entry in a file (with sed)
echo "tag=$tag"
echo "FILE_PATH=$FILE_PATH"
export LINE_MARK="tag:"
sed -i'' -e "0,/$LINE_MARK .*/s//$LINE_MARK $tag/" "$FILE_PATH" # replace first entry
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment