0

I have to answer this question as an exercise.

  1. Sample input: No sample, just trying to select and filter files using Unix shell according to some conditions

  2. Sample output: a list of files that their name is composed of 4 letters and which contain the string “user” in their content.

  3. I tried to use the basename ~/ command to get the file name of some files, then tried to combine it with wc by doing, for example, basename /etc/ |wc -c. Finally, I tried grep user file_test.txt on an arbitrary file to see if it contains the word "user".

I am trying to combine all the required commands to answer the question.

I am supposed to use substitutions which I am not used to.

Could someone please help me?

  • Welcome to SO. On SO we encourage users to add 3 important things in their question. 1st- Sample of input, 2nd- sample of output, 3rd- their efforts. So please add these things in your question(not in comments please) and let us know then. – RavinderSingh13 Oct 30 '20 at 09:01
  • I think it is ok now – Ruben Cohen Oct 30 '20 at 09:24
  • Like this?: `grep -i user ????` – James Brown Oct 30 '20 at 09:44
  • There seem to be a couple of aspects here... determining which files to search in (try Googling *"bash wildcards"*) and searching in a file for the word `"user"` (try `man grep`). – Mark Setchell Oct 30 '20 at 09:47
  • If all the files you're looking for are in your current directory, `grep -Fl user ????` should do it. – Shawn Oct 30 '20 at 11:45

0 Answers0