I'd like to create many files from one buffer. Is there an easy way to do this? So starting with
foo1.txt
1a
1b
1c
1d
foo2.txt
2a
2b
2c
2d
foo3.txt
3a
3b
3c
3d
make 3 files, named foo 1 2 and 3 .txt, with the contents.
Is there something less cluncky than this?
echo 1a > foo1.txt
echo 1b >> foo1.txt
echo 1c >> foo1.txt
echo 1d >> foo1.txt
Edit: sorry, the 1a, 1b etc. is meant to symbolize more complex content that I am doing find/replace to in the text editor. I think HERE docs was what I was looking for. Cheers
for suffix in {1..3}; do echo "whatever" >> "foo${suffix}.txt"; done?