How can I added a text for one file to another files "Multi Text files"
I'll be grateful If someone help me with below issue; I have one file hello.txt
which contains the text "Hello all " and I want this text to be added with mult开发者_如何学编程iple files has text "this me", and first text to be above with each files.
What I mean is, hello.txt has the text = "Hello all ", and multiple files 1.txt 2.txt 3.txt 4.txt 5.txt . . 20.txt all have the text "this me".
What I need is 1.txt ..... 20.txt the text be "hello all this me"
How can I do this?
I'm not sure I understand what you want 100%, but something like this ought to do the job:
set -e
for f in 1.txt 2.txt 3.txt ...
do
cat hello.txt "$f" > "$f"T
mv -f "$f"T "$f"
done
精彩评论