Q: Grep Search in Shell Script Trying to implement a system which is based on shell script and PHP. Getting the string from PHP file and processing through shell scripts. 
Every time it's working except some time where strings are like : "/jobs?location_country=united+states&sort_by=cfml10%2cdesc&v_location=usa" 
grep for this command not working. 
How to solve this?
Code is : 
hcm=$(php largest.php "$file"_hcm_input.txt "$remove")
echo "$hcm"
grep "$hcm" "$file"_sorted.txt > "$file"_jobs.txt


A: Use grep -F or grep --fixed-strings to tell grep to treat the argument as a fixed string rather than a regex.

A: As you have & in the string, even if you enclose it in single/double quotes it won't work.
In this case you have to escape &, using \ like \&.

A: After getting lot hit and trial found out that this is not the issue with & = or + as i have checked individually 
grep "=" s37_sorted.txt 
grep "&" s37_sorted.txt 
grep "+" s37_sorted.txt 

Giving me output. 
Exact reason was the case. So we need to find with case insensitive manner for that we have to follow the following code and parameter with grep is -i
hcm=$(php largest.php "$file"_hcm_input.txt "$remove")
echo "Highest Common String:"$hcm
grep -i "$hcm" "$file"_sorted.txt > "$file"_jobs.txt

Now it's showing me 366 records.
