Find the answer to your Linux question:
Results 1 to 2 of 2
hi all. would very much appreciate any insight someone could lend. i need help understanding how to pass parameters to an exec statement. here's what i have thus far... Code: ...
  1. #1
    Just Joined!
    Join Date
    Apr 2009
    Posts
    1

    Need help with EXEC parameters

    hi all. would very much appreciate any insight someone could lend. i need help understanding how to pass parameters to an exec statement. here's what i have thus far...

    Code:
    awk -F \/ '{print $0 substr($2,1,2)"-"substr($3,1,2)}' dirlist -exec id3 -c '{2}' {1} \;
    the problem i'm facing is not having the two commands speak to each other.
    i've tested the id3 command, and have that working as intended. i've also tested my awk statement, and it's working as intended.

    the output of the awk statement looks something like this:
    ./01-Directory1/01-File1.mp3 01-01
    ./01-Directory1/02-File2.mp3 01-02
    ./02-Directory2/01-File1.mp3 02-01
    ./02-Directory2/02-File2.mp3 02-02

    as you can see, i've lined up the awk to print out in parameter style.

    problem #1: anyone know how to stop awk from trying to process the "-exec" portion (error listed as 'fatal: cannot open file `-exec' for reading (No such file or directory))?

    problem #2: is my parameter structure of the exec statement correct?

    thanks in advance for any help you may extend.

  2. #2
    Linux Enthusiast
    Join Date
    Aug 2006
    Location
    Portsmouth, UK
    Posts
    539
    I don't have dirlist or id3 so not entirely sure what they generate, however Try this:
    Code:
    dirlist -exec id3 -c '{2}' {1} \ | awk -F \/ '{print $0 substr($2,1,2)"-"substr($3,1,2)}'


    Scrub that, what are you trying to achieve?
    RHCE #100-015-395
    Please don't PM me with questions as no reply may offend, that's what the forums are for.

Posting Permissions

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