Created
April 13, 2017 00:40
-
-
Save tanzyy/382cf71812bc8d99d9407517100dec37 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#This script shows how to pass shell variable to awk using option -v | |
index_pos="4" | |
search_string="31/Mar/2017:03:58:38" | |
cat ~/Desktop/tempp.txt | awk -v pos=$index_pos -v ss=$search_string '{ if($pos==ss) print $0 }' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment