i have a very strange problem. i made a script composed of just 5 line. it is containing awk and nawk codes and it is working perfectly when it is applied one-by-one (copy & paste).
but when i type run myscript.mos , it is giving:
nawk: syntax error at source line 1
context is
bla bla bla...
error???
how can this strange situation happen in such a strange manner??
1st line: process params.txt and ip.txt and write result (write "l. /moshell ...") to command.mos
2nd line: run command.mos
3rd line: text formatting
4th line: text formatting
5th line: remove unnecessary files
when i try to run this script, error is:
192.168.1.1> run get.mos //i have typed this and script is starting
192.168.1.1> l nawk 'NR==FNR{a=a?a"get . "$0";":"get . "$0";";next;}{print "l ./moshell "$0" "c"lt all;l+;" a "l-;l cat $logfile >> /home/gc_sw/log.txt;l rm $logfile"c}'
c="'" /home/gc_sw/params.txt /home/gc_sw/ip.txt > /home/gc_sw/command.mos
nawk: syntax error at source line 1
context is
NR==FNR{a=a?a"get . "run >>> get. <<< mos ";":"get . "run get.mos ";";next;}{print "l ./moshell "run get.mos " "c"lt all;l+;" a "l-;l cat
$logfile >> /home/gc_sw/log.txt;l rm $logfile"c}
nawk: illegal statement at source line 1
192.168.1.1> run /home/gc_sw/command.mos
192.168.1.1> l awk ' $2 ~ /[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/ {print "\n" $2 } NF == 3 && $1 ~ /^.*=.*$/ {print $0 }' /home/gc_sw/log.txt > /home/gc_sw/1.txt
awk: can't open /home/gc_sw/log.txt
192.168.1.1 l nawk '/^[0-9]/&&p!=$1{printf "\n%s",p=$1} NF>1{$1=$1;sub($1" "$2" ","\t"$1"\t"$2"\t");print}' /home/gc_sw/1.txt > /home/gc_sw/sitedata.xls
192.168.1.1> l rm /home/gc_sw/command.mos /home/gc_sw/log.txt /home/gc_sw/1.txt /home/gc_sw/log.txt: No such file or directory
192.168.1.1> waiting for command
i am using MOshell interface being started from a Unix Terminal.
run : a moshell command to execute .mos file.
l : at moshell session, type "l" and then write unix commands. it is something like "opening a unix channel"
As I neither use "tcsh" or "MOshell" its time to back off. In reading about MOshell I did notice that people escape underscore characters in external commands for some reason \_ .
What you are attempting looks complex and the mixture of syntax is difficult to follow. Any way you can get the external commands into unix scripts?