Quote:
Originally Posted by Four
Hi,
I would like to do the following
cat somefile | m4 > somefile
The idea is to take somefile and process it with m4 and just replace it with somefile. I have alot of files I want to be processed by m4. Is it possible to do it all in oneline instead of doing line by line?
And is it possible to make a simple function in the console just for one time use in linux?
Thanks
|
If you have many files, and you are going to want to do it again, how about using a makefile with a rule to process it:
makefile:
Code:
FILES=a b c d e f g
all: $(foreach file, $(FILES), $file.out)
%.out:%
m4 $* >$*.out
Then a simple "make" should do it. You will have to adapt ".out" to the extension you want for it. This comes with the advantage that if you change one file, you can run this again, and it will only update for the file that changed. I am sure this is probably not the best solution, but being more familiar with dev tools than straight shell scripting I nearly always dive for a make file or perl script.
Danny