I'm wanting to append some information to a file, which is found in a different file. I have simplified the problem using animals.
Here is the basic code to add the line to the file:
grep "some important info about rabbits" rabbits.data >> rabbits.txt
Very simple, but this must be repeated over lots of pre-existing files, e.g. for birds (birds.data, birds.txt), bees (bees.data, bees.txt), beetles (beetles.data, beetles.txt) etc, etc.
The files always have the same prefix (e.g. rabbits), but the file suffixes are different (.data, .txt).
The files must match - only info from rabbits.data should go into rabbits.txt etc
I'm sure this must be wrapped in a "for" loop, but I've had no luck so far, even after reading several tutorials and searching the forum. Any pointers in the right direction are greatly appreciated.