4

This question already has an answer here:

Let's say that I have files f1, ..., f9. I want to create a single view -- or a soft link -- say f, that displays a concatenated view over the 9 files.

For example, if I execute wc -l f the answer should be the sum of all individual wc -l fi for i in 1 to 9. If I edit any single file fi then the view f should automatically update, such as its modification time. So basically f is a soft link that tracks a sequence of files.

Is there any filesystem that supports something like this?

marked as duplicate by Gilles files Jan 31 at 23:31

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Would shell globbing work? wc -l f* – Jesse_b Jan 31 at 16:55
  • 1
    For which commands do you want this 'soft link concatenation'? – sudodus Jan 31 at 17:03
  • 1
    Standard Unix doesn't have this but GNU/Hurd or Plan9 might, using some sort of special file that concatenates the set of files when read. But I don't know enough about those systems to say something constructive. – Kusalananda Jan 31 at 17:07
  • @Kusalananda Linux can do that too with FUSE; but I'm not aware of any ready-made thing doing exactly that kind of thing (That kind of concatenation usually done at volume/device rather than file/inode level). Anyways, this has nothing to do with symlinks. – pizdelect Jan 31 at 17:40
  • 1
    Real duplicate: unix.stackexchange.com/q/94041/237982 – Jesse_b Feb 2 at 19:37
1

Depending on what you are planning to do a function might meet your requirements:

cf () { cat /path/to/f1 /path/to/f2 /path/to/f3; }

It wouldn't act as a file per say but you could use process substitution to fake it:

wc -l < <(cf)

Or in the example of wc -l it may be easier to just:

cf | wc -l

Not the answer you're looking for? Browse other questions tagged or ask your own question.