Thursday, May 2, 2024
17
rated 0 times [  17] [ 0]  / answers: 1 / hits: 1437  / 2 Years ago, sat, june 18, 2022, 10:38:32

I have two huge files (150G each) and I need to use a tool for which I should supply them as a single file (since the tool only accepts one file). However, I do not want to merge these files for several reasons, but I cannot pipe them using something like <(cat file1 file2) or myfile=$(cat file1 file2) because the script uses the path of the input file, not its content.


So I would need something like the following:


alias myfile = "cat file1 file2"

So that using the following command would work:


tool_x --file /path/myfile 

I already tried this mentioned command, but it didn't work.


I would just need to be able to treat the result of a "cat" command as an actual file, with the possibility to accessing this file using a path.


Is it possible to achieve something like that?


More From » command-line

 Answers
0

You could use a named pipe:


mkfifo /path/myfile
cat file1 file2 > /path/myfile &

Here, either the cat command has to be sent to the background, or you can run tool_x in another terminal, as cat will block until something starts reading from the pipe:


tool_x --file /path/myfile

This is essentially what process substitution is doing automatically for you.


[#103] Monday, June 20, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
herfor

Total Points: 490
Total Questions: 101
Total Answers: 110

Location: Guadeloupe
Member since Mon, Jan 24, 2022
2 Years ago
;