beaster,
I'll try to do my best here, but.... you _really_ need to read up on shell programming and on awk/nawk syntax. It would be somewhat difficult to explain everything here starting with the _basics_. All my comment will be prefixed with the comment "#vlad "
I'd spend some time thinking what of the objective of what needs to be done _FIRST_. The I'd go though some sample shell/awk examples/books of how similar tasks can be achived.
sorry - but it's kinda hard to explain everything in "two words or less"
vlad
#!/bin/sh
#Written by BeasteR to Notify Individuals of Critical and Major Alarms
today=`date +%m%d%y`
# vlad
# this is NOT the place to do these assignments. My previous # comment in this thread was in regards to the _awk_ script. # You derive your file from _within_ awk and _NOT_ in the
# shell script wrapper.
#outputFile1="bh1msc_sms"NR
#outputFile2="bh2msc_sms"NR
#outputFile3="bh1bsc1_sms"NR
#outputFile4="bh1bsc2_sms"NR
#outputFile5="bh2bsc1_sms"NR
#outputFile6="bh2bsc2_sms"NR
#outputFile7="bhmscp1_sms"NR
#Remove previous files
#rm *stripped*
# vlad
# a better approach [not hardwire and create repetetive code]
# is to create an array of files [alarmsArra] and iterate
# through the array. The output files can be derived from the
# "source" file names [by concatenating a string "stripped1"]
sed '/^[\t]*$/d' bh1msc_alarms > bh1msc_stripped1
sed '/^[\t]*$/d' bh1bsc1_alarms > bh1bsc1_stripped1
sed '/^[\t]*$/d' bh1bsc2_alarms > bh1bsc2_stripped1
sed '/^[\t]*$/d' bh2msc_alarms > bh2msc_stripped1
sed '/^[\t]*$/d' bh2bsc1_alarms > bh2bsc1_stripped1
sed '/^[\t]*$/d' bh2bsc2_alarms > bh2bsc2_stripped1
sed '/^[\t]*$/d' bhmscp1_alarms > bhmscp1_stripped1
# vlad
# what is this?
# the comment above can be applied here as well. Why can't
# you do the "sed"-ing [as above] and the "grep"-ing in _ONE_
# contigues stream?
fgrep -f msc_sms_grep bh1msc_stripped1 > bh1msc_stripped2
fgrep -f msc_sms_grep bh2msc_stripped1 > bh2msc_stripped2
/usr/xpg4/bin/fgrep -f bsc_sms_grep bh1bsc1_stripped1 > bh1bsc1_stripped2
/usr/xpg4/bin/fgrep -f bsc_sms_grep bh1bsc2_stripped1 > bh1bsc2_stripped2
/usr/xpg4/bin/fgrep -f bsc_sms_grep bh2bsc1_stripped1 > bh2bsc1_stripped2
/usr/xpg4/bin/fgrep -f bsc_sms_grep bh2bsc2_stripped1 > bh2bsc2_stripped2
/usr/xpg4/bin/fgrep -f bsc_sms_grep bhmscp1_stripped1 > bhmscp1_stripped2
#rm *stripped1*
# vlad
# I've modified the _first_ awk - you change others - I'm
# simply lazy.
awk 'BEGIN {root=substr(FILENAME,1,index(FILENAME,"_"

-1) "sms";} {outputFile=root"NR;print > outputFile1}' bh1msc_stripped2
awk '{print > outputFile2}' bh2msc_stripped2
awk '{print > outputFile3}' bh1bsc1_stripped2
awk '{print > outputFile4}' bh1bsc2_stripped2
awk '{print > outputFile5}' bh2bsc1_stripped2
awk '{print > outputFile6}' bh2bsc2_stripped2
awk '{print > outputFile7}' bhmscp1_stripped2
rm *stripped*