I have a textfile with the following strings with a comma in them:


How can I grep * using this textfile? I've tried to use grep -xFf textfile * but I don't get any results even if there are files that contain these strings.

a sample datafile within * contains this line: 1231920383939,'unix:///run/John,Smith','{}'

input: grep -xFf textfile *

output: (blank)

  • The data files contain text in this format: 1539198827392,'John,Smith','{}' if I use grep -xFf samplefile * I can't get that line for some reason – kouichi Oct 30 '18 at 23:57
  • I think I can use grep -wFf textfile * instead, running some tests now – kouichi Oct 31 '18 at 0:07

Your problem appears to boil down to the erroneous inclusion of the -x option to grep, which requires that the matched text be the only text on the line. Remove the x flag and you'll get the results you're looking for.

  • 1
    Thanks Jeff. For some reason I couldn't get any output at first even when not using the -x option. The grep works now without the -x flag – kouichi Oct 31 '18 at 0:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.