Skip to content

Instantly share code, notes, and snippets.

@parnurzeal
Last active August 29, 2015 13:58
Show Gist options
  • Save parnurzeal/9966431 to your computer and use it in GitHub Desktop.
Save parnurzeal/9966431 to your computer and use it in GitHub Desktop.
A solution for grep a file with too long line. Usage: ./grep_too_long_line.sh FILE WORD_TO_CUT WORD_TO_FIND
#!/bin/bash
ORG_FILE=$1
WORD_TO_CUT=$2
WORD_TO_FIND=$3
zcat ${ORG_FILE} | sed 's/'${WORD_TO_CUT}'/'${WORD_TO_CUT}'\n/g' | grep ${WORD_TO_FIND}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment