I have a file like below
#Fields section bald
1234 2345 456 222
abcs dddd dddd ssss
mmmm mmm mmm
i need do not process a files stating with #
I was written code below
while read -r line
do
if [ egrep -v '^#' $file]
then
echo ${line} >>
elif [ $scode -le 399 ]
then
echo ${line} >>access.log
else
echo ${line}>>error.log
done > $file
it processing but not expectings
and also tried below like
while read -r line
do
if [ egrep -v '^#' $file]
then
echo ${line} >>
elif [ $scode -le 399 ]
then
echo ${line} >>access.log
else
echo ${line}>>error.log
done > `egrep -v '^#' $file`
it is processing but not going to specific file which i am expecting to access and error.logs
Please correct me where should i correct my script.
both are not working as expected