Skip to content

Instantly share code, notes, and snippets.

@monkseal
Last active September 4, 2018 20:29
Show Gist options
  • Save monkseal/9b840792a435168080fecbf88d9599e1 to your computer and use it in GitHub Desktop.
Save monkseal/9b840792a435168080fecbf88d9599e1 to your computer and use it in GitHub Desktop.
awk-sed-tricks.bash
# Get 3rd word:
bundle exec rails routes | grep pages | awk '{print $3}'
# Get 3rd word without (format)
bundle exec rails routes | grep pages | awk '{ gsub("\\\(.:format\\\)","",$3); print $3}'
# Run eslint, substitute out full path/ directory for project 'home-page'
yarn run eslint app/javascript | grep javascript | sed -e 's/Users\/v-kevin.english\/Projects\/home-page\///'
# get last word from an output, use awk '{print $NF}'
echo "exporting file kevin-exports.2017-10-21.json" | grep exporting | awk '{print $NF}'
# Run all changes rspec files:
git ss | grep spec | awk '{print $2}' | xargs bundle exec rspec
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment