Sponsored Content
Top Forums Shell Programming and Scripting programme is ok but not working in script Post 302493877 by gc_sw on Friday 4th of February 2011 03:57:29 AM
Old 02-04-2011
ok. this is my code:
Code:
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
2> run /home/gc_sw/command.mos
3> 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
4> 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
5> l rm /home/gc_sw/command.mos /home/gc_sw/log.txt  /home/gc_sw/1.txt

Code:
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:

Code:
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

1st line of command is running with error!
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Unable to compile the c programme in unix

Hi, My name is vreddy and I am learning c language now and written one programme on vi editor. how do I compile the programme please give me some advice and that would be helpfull for me. thanks vre (10 Replies)
Discussion started by: vasudeva
10 Replies

2. Shell Programming and Scripting

want to use output of c programme in expect

hi i am having a c code which gives the output of my password in text format i.e when i run my c code which which gives the password asfollows====>>>>>> $./passwdprogram ======>>>>>>abc@123(this is the output) now i have an expect script to remotely ssh which uses the password set in ... (0 Replies)
Discussion started by: xander
0 Replies

3. Programming

Need help in a c programme

Dear Friends, I ve two text files like re_im.dat 13.7663000000 5.9572200000 10.2682000000 10.9345000000 5.0810700000 14.1132000000 two real values per row Sarf.dat 127 128 128 128 71 0 128 128 128 128 71 0 128 128 128 128 71 0 This is having 6... (2 Replies)
Discussion started by: user_prady
2 Replies

4. Shell Programming and Scripting

snmpget in a perl programme

Hi Guyz can u tell me how to write a programme in perl using snmpget. Regards' Harrr (0 Replies)
Discussion started by: Harikrishna
0 Replies

5. Programming

cobol programme

I have some compile programme .crn now I want to run .crn programme on express cobol which allow only *.gnt programme any solution to run *.crn programme (0 Replies)
Discussion started by: bibi
0 Replies

6. Programming

help with C programme to lock remote resources

hello every one i am working on a project to lock remote computer resources(hard drive, usb, cd- rom, folder etc). i have maintained connection using JAVA RMI and using JAVA JNI to lock resources, now i am really stuck up with C programme to do actual locking, i am using RHL-5 on admin computer... (7 Replies)
Discussion started by: zius_oram
7 Replies

7. Programming

starting programme in C

hello, For school i make the next mission: give how many chambers in a constant number. use an array which chamber is free and count how many chamber there are free. make also something to test I don't now how to start. I need an well example so i can make the mission thank you (1 Reply)
Discussion started by: wouter88
1 Replies

8. Programming

Help for coding this programme

for a floating-point array x whose size is n, find the geometric mean.. GM =n x1.x2.x3...xn (2 Replies)
Discussion started by: allyjaah
2 Replies

9. Shell Programming and Scripting

Script is not working from cron while working manually

Hello, I am facing a very strange problem when I run my script manuallu ./Fetchcode which is using to connect with MKS integrity from linux end it workks fine but when I run it from cron it doesn't work.Can someone help me 1) How could I check my script when it is running from cron like... (3 Replies)
Discussion started by: anuragpgtgerman
3 Replies

10. Shell Programming and Scripting

Script not working in cron but working fine manually

Help. My script is working fine when executed manually but the cron seems not to catch up the command when registered. The script is as follow: #!/bin/sh for file in file_1.txt file_2.txt file_3.txt do awk '{ print "0" }' $file > tmp.tmp mv tmp.tmp $file done And the cron... (2 Replies)
Discussion started by: jasperux
2 Replies
set_color(1)							       fish							      set_color(1)

NAME
set_color - set_color - set the terminal color set_color - set the terminal color Synopsis set_color [-v --version] [-h --help] [-b --background COLOR] [COLOR] Description Change the foreground and/or background color of the terminal. COLOR is one of black, red, green, brown, yellow, blue, magenta, purple, cyan, white and normal. o -b, --background Set the background color o -c, --print-colors Prints a list of all valid color names o -h, --help Display help message and exit o -o, --bold Set bold or extra bright mode o -u, --underline Set underlined mode o -v, --version Display version and exit Calling set_color normal will set the terminal color to whatever is the default color of the terminal. Some terminals use the --bold escape sequence to switch to a brighter color set. On such terminals, set_color white will result in a grey font color, while set_color --bold white will result in a white font color. Not all terminal emulators support all these features. This is not a bug in set_color but a missing feature in the terminal emulator. set_color uses the terminfo database to look up how to change terminal colors on whatever terminal is in use. Some systems have old and incomplete terminfo databases, and may lack color information for terminals that support it. Download and install the latest version of ncurses and recompile fish against it in order to fix this issue. Version 1.23.1 Sun Jan 8 2012 set_color(1)
All times are GMT -4. The time now is 11:45 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy