[Solved] awk string with spaces

view story

http://www.unix.com – Why does this work: Code: awk -v s="this is a string" 'index($0, s)' file while the following doesn't? Code: s="this is a string" awk -v s=$s 'index($0, s)' file How do I search for a string with spaces in it? ---------- Post updated at 01:18 AM ---------- Previous update was at 01:15 AM ---------- I figured it out. Had to use double quotes: Code: awk -v s="$s" 'index($0, s)' file (HowTos)