S
S
shledon2022-01-27 20:25:30
linux
shledon, 2022-01-27 20:25:30

Why service characters do not work everywhere?

I'm probably trying to do complete nonsense right now (most likely), but still I'm still dealing with Linux (Understand and forgive).
I'm trying to use service-characters or special characters or command-characters! they are called differently everywhere, and there are also regular expressions (as I understand it, this applies only to grep) ... Well, nothing works, I want to redirect the asdasdasd text in file 1.txt to other files with the .txt extension, but it turns out this only if you use the full name for example cat 1.txt > 3.txt then everything is transferred, what am I doing wrong and how is it right?

spoiler
ARL071f.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Karabanov, 2022-01-27
@shledon

bash can't do that, after expanding the arguments, there is an ambiguity due to the large number of arguments (in fact, the error message says "ambiguous redirect" in the error message).
You can use the utility tee, it can do this, for example: it
cat 1.txt | tee {2,3,4,5}.txt 1>/dev/null
teedirects output to a file and to standard output, you can not add 1>/dev/null, then the contents of the file will also be displayed on the screen, but this is hardly required in this situation.

D
Drno, 2022-01-27
@Drno

Well, how would you like it differently? You are trying to write information to a file, the system needs to know which file you want to write to ...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question