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:
have terminal print out full hyphen separated list can copy/paste it?
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
Post a Comment