Sponsored Content
Top Forums Shell Programming and Scripting if: expression syntax error in gawk Post 302589806 by aigles on Thursday 12th of January 2012 04:22:05 PM
Old 01-12-2012
The syntax of the generated if statement is not valid in csh.
Code:
qstat -u jmarell | if [ `grep -c 348240` -eq 0 ]; echo 348240

A solution is to generate a statement like that :
Code:
qstat -u jmarell | grep -q 348240 || echo 348240

Another approch to solve your problem :
Code:
qstat -u jmarell |
awk '
    FILENAME=="-" { JobId[$1] = $2; next }
    ! ($2 in JobId) { print "Job id", $2, "not found" }
' - ~/curJobs.log

jean-Pierre.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

One more expression syntax error

HI again, still working on the assignment, which is really hard given we just started unix 4 weeks ago. This script should change the permission for the user depending if its x, w or r, to the opposite. When i try to run it, I am getting expression error. Can you spot where the problem is? I really... (3 Replies)
Discussion started by: morava
3 Replies

2. Shell Programming and Scripting

Expression syntax

Hello, I am getting Expression syntax message and I cannot figure out what's wrong. This program will print all the odd numbers between 0 and the one the user enters, in cshell. I think my logic is either good or almost there, but i dont see the errors. I think it could be the spaces between... (1 Reply)
Discussion started by: morava
1 Replies

3. Shell Programming and Scripting

syntax error for if statment test expression

Hi what's the correct way of writing if 1)if "$time_diff" -gt 5 then echo "killing hung process \n" fi 2)if test $time_diff -gt 5 then echo "killing hung process \n" fi where -time_diff=$(($Sam - $current_min)) and current_min=`date +%M` infact both are giving Syntax... (1 Reply)
Discussion started by: Anteus
1 Replies

4. UNIX for Dummies Questions & Answers

Syntax Help | unix | grep | regular expression | repetition

Hello, This is my first post so, Hello World! Anyways, I'm learning how to use unix and its quickly become apparent that a strong foundation in regular expressions will make things easier. I'm not sure if my syntax is messing things up or my logic is messing things up. ps -e | grep... (4 Replies)
Discussion started by: MykC
4 Replies

5. Shell Programming and Scripting

if expression syntax error

#! /bin/csh set umr=UMR foreach i ( `ls`) set file_nm=$i set bh_nm=`echo $file_nm | cut -d"_" -f2` if($bh_nm !=$umr) then { set bh_ext=`echo $file_nm | cut -d"_" -f4` set bh_num_nm="$bh_nm $bh_ext a .txt" mv $file_nm $bh_num_nm } ... (1 Reply)
Discussion started by: jdsignature88
1 Replies

6. UNIX for Dummies Questions & Answers

If Then ElseIf Script - Confusion Around Expression's Syntax

Hello, I am relatively new to UNIX scripting and am learning a lot. I have already tried several searches on this website and have tried various syntax options suggested to no avail. I am obviously not writing the script correctly. I really do appreciate any and all the help. Below is an... (8 Replies)
Discussion started by: dqrgk0
8 Replies

7. Shell Programming and Scripting

If expression syntax

Hello there! I am having some difficulties in the syntax of a script. I am a newbie :) What i want is a script that copies 1 or more files to a destination folder with a question if file allready exists if ($#argv > 2) then if (-d $argv($#argv)) then foreach x ($*) cp -i $x to... (4 Replies)
Discussion started by: ennui92
4 Replies

8. Shell Programming and Scripting

Help with awk script (syntax error in regular expression)

I've found this script which seems very promising to solve my issue: To search and replace many different database passwords in many different (.php, .pl, .cgi, etc.) files across my filesystem. The passwords may or may not be contained within quotes, single quotes, etc. #!/bin/bash... (4 Replies)
Discussion started by: spacegoose
4 Replies

9. Shell Programming and Scripting

TCL: syntax error in expression with "*"

I'm using tcl scripts in ns2 ( network simulator) through cygwin. It works fine , however, I downloaded an example when i run it , I got the following syntax error: syntax error in expression with " *2" : unexpected operator * while executing : "expr $bw *2" invoked from within: "$ns... (1 Reply)
Discussion started by: ENG_MOHD
1 Replies

10. Shell Programming and Scripting

Observing error :syntax error in expression

#!/bin/bash a1="04:29:39 - System health check failed" i=$1 echo "a $((a$i))" The script above gives the following error $113> sh tryt.sh 1 tryt.sh: line 6: 04:29:39 - System health check failed: syntax error in expression (error token is ":29:39 - System health check failed") It... (1 Reply)
Discussion started by: ashima jain
1 Replies
SGE_QSTAT(5)						   Sun Grid Engine File Formats 					      SGE_QSTAT(5)

NAME
sge_qstat - Sun Grid Engine default qstat file format DESCRIPTION
sge_qstat defines the command line switches that will be used by qstat by default. If available, the default sge_qstat file is read and processed by qstat(1). There is a cluster global and a user private sge_qstat file. The user private file has the highest precedence and is followed by the clus- ter global sge_qstat file. Command line switches used with qstat(1) override all switches contained in the user private or cluster global sge_qstat file. The format of the default files is: o The default sge_qstat file may contain an arbitrary number of lines. Blank lines and lines with a '#' sign at the first column are skipped. Each line not to be skipped may contain any qstat(1) option as described in the Sun Grid Engine Reference Manual. More than one option per line is allowed. EXAMPLES
The following is a simple example of a default sge_qstat file: ===================================================== # Just show me my own running and suspended jobs -s rs -u $user ===================================================== Having defined a default sge_qstat file like this and using qstat as follows: qstat has the same effect as if qstat was executed with: qstat -s rs -u <current_user> FILES
<sge_root>/<cell>/common/sge_qstat global defaults file $HOME/.sge_qstatuser private defaults file SEE ALSO
sge_intro(1), qstat(1), Sun Grid Engine Installation and Administration Guide COPYRIGHT
See sge_intro(1) for a full statement of rights and permissions. SGE 6.2u5 $Date$ SGE_QSTAT(5)
All times are GMT -4. The time now is 07:44 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy