Jun 7, 2012 at 10:39am UTC
Assume you have in a folder the following .c files
reference.c
test.c
test1.c
test2.c
...
testn.c
You want to copy the content of reference.c in all files (test, test1,..., testn)
Is there any shell command to automate this process?
Jun 7, 2012 at 10:41am UTC
type reference.c > test.c
Do you mean something like that?
Jun 7, 2012 at 10:45am UTC
I want to automatize the process. That means, with just single or two command I will able to copy the content of reference.c in all test files (test.c, test1.c, ...,testn.c).
Jun 7, 2012 at 11:00am UTC
for %a in (test*.c) do type reference.c > %a
think about it, simple batch -.-*
Last edited on Jun 7, 2012 at 11:02am UTC
Jun 7, 2012 at 11:25am UTC
when I perform it I get the following error:
for %a in (*.c) do type reference.c > %a
bash: syntax error near unexpected token `('
any suggestion...
Last edited on Jun 7, 2012 at 11:26am UTC
Jun 7, 2012 at 11:54am UTC
to copy the content of reference.c in all test files
¿Append, or they should be equal? I suppose that you can't just make a link.
¿Which shell are you using?
1 2 3 4
#!/bin/bash
for file in test*.c; do
cp reference.c "$file"
done
Last edited on Jun 7, 2012 at 11:55am UTC
Jun 7, 2012 at 12:35pm UTC
Damn, sry, my version is vor MS-DOS.