Find the answer to your Linux question:
Results 1 to 3 of 3
I am trying to run this command but wish to modify it so it outputs files that contain both 'quality=x' and 'quality=vg'. Not just 'quality=x'. how do I modify it ...
  1. #1
    Just Joined!
    Join Date
    Feb 2007
    Posts
    9

    finding certain text within a document - command line query

    I am trying to run this command but wish to modify it so it outputs files that contain both 'quality=x' and 'quality=vg'. Not just 'quality=x'. how do I modify it so it works

    find . -name \*.meta | xargs grep "^quality=x" | cut -d : -f 1 > /tmp/test

    if its any clearer this is what I want it to do...

    find . -name \*.meta | xargs grep "^quality=x" OR "^quality=vg" | cut -d : -f 1 > /tmp/test

  2. #2
    Linux Guru anomie's Avatar
    Join Date
    Mar 2005
    Location
    Texas
    Posts
    1,692
    Try egrep '^quality=x|^quality=vg'

  3. #3
    Just Joined!
    Join Date
    Feb 2007
    Posts
    41
    Running xargs here is redundant as you can use the -exec option of find.

    Code:
    find . -name '*.meta' -type f -exec egrep '^quality=x|^quality=vg' {} \; | cut -d : -f 1

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...