shell - converting a list of files to a hyphen separated list -


say have folder contains following files

stuff1001.f stuff1002.f stuff1003.f ... stuff1099.f 

i have command requires me enter these files in hyphen separated list such that

command.py -i stuff1001.f-stuff1002.f-stuff1003.f-... 

how can i:

  1. have terminal print out full hyphen separated list can copy/paste it?

  2. enter code command this?

the following may help:

ls -1 | tr '\n' '-'

the ls -1 (that's dash one) command writes name of each file in current directory separate line. tr '\n' '-' command translates each newline hyphen. end result hyphen-separated list of files in current directory.


Comments

Popular posts from this blog

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - UML - How would you draw a try catch in a sequence diagram? -

c++ - No viable overloaded operator for references a map -