Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

problem in scripting

Tags:

shell

unix

ksh

when I am executing this on the command line:

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

it executes vey nicely without taking much time and instantly gives me the output file.

but when I am including 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 is generating a 0 byte files. may I know what is the problem here?

like image 682
Vijay Avatar asked May 12 '26 21:05

Vijay


1 Answers

Remove >/dev/null because that is where your stdout is being redirected to.

like image 108
dogbane Avatar answered May 14 '26 10:05

dogbane



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!