unix - How to use pipe within -exec in find -


Is there any way to find any -ACAC pipe? I do not want to go through the whole file of grep, but only through the first line of each file

  find / path / to / dir -type fprint -exec grep yourstring {} \;   

I tried to put pipelines with "cat" and "head-1", but it does not work very well. I tried to use brackets in some way, but I did not manage the management to fix it. I would be very grateful for your help. I know how to work in other ways without using it, but we Tried to find it in school and with pipeline use, but how could it not manage Find / Path / From / Direct Type f -print -exec Bill {} | Head-1 Your string grep;

This is how we have tried to do somehow, but can not manage the bracket and it is also possible that this is also possible. I tried to look through the net, but no answer was found.

Use a pipe to be enabled, give you an shell command There is a need to execute, that means the command with the pipeline should have a command for -exec .

  find / path / to / dial type F-print-xac sh -c "cat {} | head-1 | gffirstring" \;   

Note that there is an unused use cat above, which can be written as:

  find / path / From / Dir -type f -print -exec sh -c "head -1 {} | grep yourstring" \;   

Another way to get what you want will be to say:

  find / path / to / direct type F-print-xac Awk 'NR == 1 & amp; Amp; / Yourstring / '{} \;    

Comments

Popular posts from this blog

python - how we can use ajax() in views.py in django? -

matlab - Using loops to get multiple values into a cell -

python - Sequence Pattern recognition with Pybrain -