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
GIT-SH-SETUP(1) 						    Git Manual							   GIT-SH-SETUP(1)

NAME
git-sh-setup - Common Git shell script setup code SYNOPSIS
. "$(git --exec-path)/git-sh-setup" DESCRIPTION
This is not a command the end user would want to run. Ever. This documentation is meant for people who are studying the Porcelain-ish scripts and/or are writing new ones. The git sh-setup scriptlet is designed to be sourced (using .) by other shell scripts to set up some variables pointing at the normal Git directories and a few helper shell functions. Before sourcing it, your script should set up a few variables; USAGE (and LONG_USAGE, if any) is used to define message given by usage() shell function. SUBDIRECTORY_OK can be set if the script can run from a subdirectory of the working tree (some commands do not). The scriptlet sets GIT_DIR and GIT_OBJECT_DIRECTORY shell variables, but does not export them to the environment. FUNCTIONS
die exit after emitting the supplied error message to the standard error stream. usage die with the usage message. set_reflog_action set the message that will be recorded to describe the end-user action in the reflog, when the script updates a ref. git_editor runs an editor of user's choice (GIT_EDITOR, core.editor, VISUAL or EDITOR) on a given file, but error out if no editor is specified and the terminal is dumb. is_bare_repository outputs true or false to the standard output stream to indicate if the repository is a bare repository (i.e. without an associated working tree). cd_to_toplevel runs chdir to the toplevel of the working tree. require_work_tree checks if the current directory is within the working tree of the repository, and otherwise dies. require_work_tree_exists checks if the working tree associated with the repository exists, and otherwise dies. Often done before calling cd_to_toplevel, which is impossible to do if there is no working tree. require_clean_work_tree <action> [<hint>] checks that the working tree and index associated with the repository have no uncommitted changes to tracked files. Otherwise it emits an error message of the form Cannot <action>: <reason>. <hint>, and dies. Example: require_clean_work_tree rebase "Please commit or stash them." get_author_ident_from_commit outputs code for use with eval to set the GIT_AUTHOR_NAME, GIT_AUTHOR_EMAIL and GIT_AUTHOR_DATE variables for a given commit. create_virtual_base modifies the first file so only lines in common with the second file remain. If there is insufficient common material, then the first file is left empty. The result is suitable as a virtual base input for a 3-way merge. GIT
Part of the git(1) suite Git 1.8.3.1 06/10/2014 GIT-SH-SETUP(1)
All times are GMT -4. The time now is 02:35 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy