Skip to main content
Wrapped code.
Source Link
agc
  • 7.4k
  • 4
  • 25
  • 54
find /tmp/test -name '*.txt' \ -exec bash -c './thulac < "$(readlink -f {})" > "/mnt/tokenized/$(basename {})"' \; 

Use find to search for files and to execute commands on the results. With bash -c 'command' you are able to execute multiple $().

Use readlink -f {} to create the full path to the result.

Use basename {} to strip the path from the result.

find /tmp/test -name '*.txt' -exec bash -c './thulac < "$(readlink -f {})" > "/mnt/tokenized/$(basename {})"' \; 

Use find to search for files and to execute commands on the results. With bash -c 'command' you are able to execute multiple $().

Use readlink -f {} to create the full path to the result.

Use basename {} to strip the path from the result.

find /tmp/test -name '*.txt' \ -exec bash -c './thulac < "$(readlink -f {})" > "/mnt/tokenized/$(basename {})"' \; 

Use find to search for files and to execute commands on the results. With bash -c 'command' you are able to execute multiple $().

Use readlink -f {} to create the full path to the result.

Use basename {} to strip the path from the result.

Source Link
ctx
  • 2.9k
  • 13
  • 19

find /tmp/test -name '*.txt' -exec bash -c './thulac < "$(readlink -f {})" > "/mnt/tokenized/$(basename {})"' \; 

Use find to search for files and to execute commands on the results. With bash -c 'command' you are able to execute multiple $().

Use readlink -f {} to create the full path to the result.

Use basename {} to strip the path from the result.