The problem is in the scripts

when I execute this on the command line:

awk 'BEGIN{OFS=FS=","}$3~/^353/{print}' axeM10_20110510100219_59.DAT_353 >log

It performs vey beautifully without taking much time and instantly gives me the output file.

but when I include this in a shell script:

#!/usr/bin/ksh

for i in *.DAT_353
do
awk 'BEGIN{OFS=FS=","}$3~/^353/{print}'  ${i} > ${i}_changed >/dev/null
done

exit

The script creates 0 byte files. can i know what is the problem?

+3
source share
2 answers

Delete >/dev/nullit because your stdout is redirected here.

+5
source

Like Dogbane, it   >redirects standard output to default. Therefore, there is no need to forcibly redirect it. Here is a link to other redirection tricks. Standard input and output redirection

0
source

All Articles