title: Grep and search for parameters with bash script
body: <p>I'm trying to make a bash script to search for words in multiple text files; there are 4 parameters but the script works only if I search for all of these, not if I search only for one or more (e.g word3 and word4).
  Word2 is a number with variable length that I don't know and I don't care about; I tried so to add a wildcard * but it gives me an error.</p>
  <p>How can I modify the script so that I can search for one, two more or all parameters, given that word2 is not known?</p>
  <pre><code>#!/bin/bash
  
  read -p &quot;word3: &quot; word3
  read -p &quot;word4: &quot; word4
  read -p &quot;word1: &quot; word1
  read -p &quot;word2: &quot; word2
  printf &quot;Searching for ${word1}:${word2}:${word3}:${word4} $(find path/to/file -name '*.txt')&quot;
  grep -i -w &quot;${word1}:${word2}:${word3}:${word4}&quot; $(find path/to/file -name '*.txt') | cut -d&quot;:&quot; -f2-
  </code></pre>
  <p>Output example is:</p>
  <pre><code>word1:numbervariablelenght:word3:word4
  </code></pre>
  <p>EDIT1:</p>
  <pre><code>*sample input
  bash script.sh
  
  word3: wordThree
  word4: wordFour
  word1: wordOne
  word2: don't know
  Searching for word1:word2:word3:word4
  
  sample output
  WordOne:somenumber:wordThree:wordFour*
  </code></pre>