Results 1 to 5 of 5

Thread: How can one use all results from previous command in a new command?

  1. #1
    Join Date
    Jul 2009
    Location
    Hippiesoldierstan
    Beans
    2,028
    Distro
    Ubuntu 14.04 Trusty Tahr

    How can one use all results from previous command in a new command?

    i have found in recent times that


    Code:
    find|grep -i  NAMEOFFILEIAMLOOKINGFOR
    is really excellent for finding scattered music files by one artist all over my harddrive

    now once i have the results i want to play all the found music files with
    Code:
    nvlc --nocolor
    how could i write just one line with both commands which would read the results from command one and use info for command two?

    files extensions here would be flac wv ape mp3 zip

    so something like

    find|grep -i NAMEOFFILEIAMLOOKINGFOR && nvlc --nocolor * FILESFOUNDINPREVIOUSCOMMAND if you see what i mean


    i cannot as yet think of a way to do this ... can any of you?
    the simplest [least amount of code] is the route i seek here




    thanx in advance shan
    Last edited by shantiq; May 4th, 2013 at 10:36 AM.
    Linux is Latin for off-the-beaten-track
    what I like MOST about our Ubuntu community ... exchanging tips to make things better .... The World should take heed :]
    ShanArt

  2. #2
    Join Date
    Feb 2007
    Location
    Romania
    Beans
    Hidden!

    Re: How can one use all results from previous command in a new command?

    You don't have to use pipes and grep:
    Code:
    find ./ -iname '*whatever*' -exec nvlc --nocolor {} +
    Check out: http://mywiki.wooledge.org/UsingFind

  3. #3
    Join Date
    Jul 2009
    Location
    Hippiesoldierstan
    Beans
    2,028
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: How can one use all results from previous command in a new command?

    thank you so much sisco

    works well also how can i filter the results so it only keeps files with extension cue;zip and does not mind if some of them are not present in search
    Last edited by shantiq; May 4th, 2013 at 10:41 AM.
    Linux is Latin for off-the-beaten-track
    what I like MOST about our Ubuntu community ... exchanging tips to make things better .... The World should take heed :]
    ShanArt

  4. #4
    Join Date
    Feb 2007
    Location
    Romania
    Beans
    Hidden!

    Re: How can one use all results from previous command in a new command?

    Please check out the link I posted. Especially the 2nd section.

  5. #5
    Join Date
    Jul 2009
    Location
    Hippiesoldierstan
    Beans
    2,028
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: How can one use all results from previous command in a new command?

    you mean in essence this section

    find . \( -name '*.mp3' -o -name '*.jpg' \) -name 'foo*' -print
    ./bar/foo.jpg ./foo.mp3





    ok artist i was lookin for here was zappa so this pretty much does what i wanted [again thanx]

    Code:
    find ./ \( -iname '*zappa*.cue' -o -iname '*zappa*.zip' \) -exec nvlc --nocolor {} +
    Last edited by shantiq; May 4th, 2013 at 10:37 AM.
    Linux is Latin for off-the-beaten-track
    what I like MOST about our Ubuntu community ... exchanging tips to make things better .... The World should take heed :]
    ShanArt

Bookmarks

Posting Permissions

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