Click to See Complete Forum and Search --> : Adding text to script generated file


Nandy
04-30-2001, 09:21 PM
I made a Korn script to filter some events from a report and create files that will hold those events in order to classify them easier. I am using the egrep command. I want to add some static text to each report and also add to the report the count of instances on each report. I can achieve the count by merely using the egrep -c. But how do I make every file to be created with my descriptive information.

Example:

The script will create 3 files containing the results from each instance.

grep packet general.info >packet.info

grep frame general.info >frame.info

grep ber general.info >ber.info

Every generated .info file should have a heading describing the file contents(that will be the static text) and also it should include the count of instances on each file(achieve by the egrep -c command).

Now bash and Korn script masters, show off y'all...

Nandy

kmj
05-01-2001, 02:26 PM
To get the header into the file, first echo it in...


echo "Bob" > File.data
echo "5-1-2001" >> File.data
grep packet general.info >> packet.info
egrep -c packet general.info >> packet.info


I'm no shell scripter, but I think that'll do it.

Nandy
05-03-2001, 09:00 PM
Thanks KML, you are right on the money!!

Nandy

kmj
05-03-2001, 11:16 PM
glad to be of service; :) I don't think I'll be of much use with your other problem, though. :(