Sponsored Content
Full Discussion: Bash script issues
Top Forums Shell Programming and Scripting Bash script issues Post 302416401 by Peter.Lovell on Monday 26th of April 2010 10:33:30 AM
Old 04-26-2010
Bash script issues

Hi.

The below part of my bash script kicks out the following error message:

Code:
[user@test01-stage-btv cmd]$ ./extract_eod_report_stats_new.sh 2010-04-23
./extract_eod_report_stats_new.sh: line 204: syntax error near unexpected token `('
./extract_eod_report_stats_new.sh: line 204: `TRANSACTIONS_RECEIVED_TOP=`grep 'Transactions' $OUTPUT_FILE_TRANSACTIONS | grep -v 'AllFirms' | grep "TX[24]" | sed s/'"'/''/g | awk -F "," '{if(x<$5) {x=$5;y=$3}} END {printf y}'`'

I have debugged the failing row (and the surrounding rows) for quite some time without being able to pinpoint the problem.

I would be very grateful for help.

Best regards,
Peter Lovell

Code:
...
TRANSACTIONS_RECEIVED=`grep 'Transactions' $OUTPUT_FILE_TRANSACTIONS | grep 'AllFirms' | grep "TX[24]" | sed s/'"'/''/g | awk -F "," '{x+=$5} END {printf x}'`
TRANSACTIONS_PUBLISHED=`grep 'Transactions' $OUTPUT_FILE_PERF_TXD | grep 'AllFirms' | grep 'TXD1' | sed s/'"'/''/g | awk -F "," '{print $5}'`
TRANSACTIONS_PRICE_ERRORS=`grep 'Transactions' $OUTPUT_FILE_TRANSACTIONS | grep 'AllFirms' | grep "TX[24]" | sed s/'"'/''/g | awk -F "," '{x+=$6} END {printf x}'`
TRANSACTIONS_QTY_ERRORS=`grep 'Transactions' $OUTPUT_FILE_TRANSACTIONS | grep 'AllFirms' | grep "TX[24]" | sed s/'"'/''/g | awk -F "," '{x+=$8} END {printf x}'`
TRANSACTIONS_REJECTED=`grep 'Transactions' $OUTPUT_FILE_TRANSACTIONS | grep 'AllFirms' | grep "TX[24]" | sed s/'"'/''/g | awk -F "," '{x+=$10} END {printf x}'`
TRANSACTIONS_CANCELLATIONS=`grep 'Transactions' $OUTPUT_FILE_TRANSACTIONS | grep 'AllFirms' | grep "TX[24]" | sed s/'"'/''/g | awk -F "," '{z=$11+$12; x+=z} END {printf x}'`
TRANSACTIONS_AMENDMENTS=`grep 'Transactions' $OUTPUT_FILE_TRANSACTIONS | grep 'AllFirms' | grep "TX[24]" | sed s/'"'/''/g | awk -F "," '{z=$13+$15;x+=z} END {printf x}'`

TRANSACTIONS_RECEIVED_TOP=`grep 'Transactions' $OUTPUT_FILE_TRANSACTIONS | grep -v 'AllFirms' | grep "TX[24]" | sed s/'"'/''/g | awk -F "," '{if(x<$5) {x=$5;y=$3}} END {printf y}'`

TRANSACTIONS_RECEIVED_TOP=`grep 'Transactions' $OUTPUT_FILE_TRANSACTIONS | grep -v 'AllFirms' | grep "TX[24]" | sed s/'"'/''/g | awk -F "," '{if(x<$5) x=$5} END {printf x}'`
TRANSACTIONS_RECEIVED_LOW=`grep 'Transactions' $OUTPUT_FILE_TRANSACTIONS | grep -v 'AllFirms' | grep "TX[24]" | sed s/'"'/''/g | awk -F "," 'BEGIN {x=999999999} {if(x>$5) {x=$5;y=$3}} END {printf y}'`
...


Last edited by zaxxon; 04-26-2010 at 11:36 AM.. Reason: use code tags please, ty
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

IP connection Bash script issues

Hello I need assistance with a bash script that needs to tell me whether in the last "x" days (which is a variable) anyone connected to the xxxx IP (which is another variable). Thank you! (1 Reply)
Discussion started by: Melchiah
1 Replies

2. Shell Programming and Scripting

for / foreach syntax issues (in bash or tcsh)

So I am new to unix, and actually anything outside drag and drop with the mouse (been learning for about a week so far) . I have been using the foreach command in tcsh because I am working on a group of files. Basically what I need is to insert part of the filename as the first line in the file.... (0 Replies)
Discussion started by: thepolypore
0 Replies

3. Shell Programming and Scripting

Bash Script issues

So what i am trying to do is write a script that takes in any number of scrambeled words and unscrambles them. I have already addressed the issues of partial matches, exits silently if there are no matches, and finds words regardless of case that they were input. but while trying to get it so... (3 Replies)
Discussion started by: alindner
3 Replies

4. Shell Programming and Scripting

Bash: renaming file issues.

Hi, i want to rename a group of directories and files of my music, some items are like this: - , for directories. - , for files. I want to do something like this: , for directories. , for files. This is my code: #!/bin/bash for fname in *.mp3; do echo item: $fname mv... (2 Replies)
Discussion started by: josco1982
2 Replies

5. Shell Programming and Scripting

Unix bash script (mv issues);

Hey guys, I've registered here as I need urgent help. This is assignment for school and as you can see below I've completed the work. I'm simply stuck on one area. :wall: This script takes the first parameter (which is to be the new extension) and each parameter after that is a file... (1 Reply)
Discussion started by: Cynosure
1 Replies

6. Shell Programming and Scripting

Bash Script Issues (If statement for file copying)

Writing a bash script for use with Geektool, pulls the battery info, and shuffles images around so that an Image geeklet can display the correct expression as the desktop background. (Eventually I intend to make it more intricate, based on more variables, and add more expressions) I'm extremely... (1 Reply)
Discussion started by: The_Ardly374
1 Replies

7. Shell Programming and Scripting

Bash Case Issues..

Hi, I'm having some trouble with using "case...esac" in Bash. I've googled it and am stuggling to understand the syntax and how to do certain things. Firstly, I want to be able to choose a case based on a variable number For example, I have in my code a place where a user can enter... (2 Replies)
Discussion started by: Ste_Moore01
2 Replies

8. Shell Programming and Scripting

Bash/cron issues

Hi all, I am trying to run a cronjob to push my files to my git repo once a week and output a prompt to a logfile, my script works fine if I invoke it manually but my cronjob wont run for some reason, I have sourced the file, and restarted my Mac to no avail, right now I believe I have the cronjob... (8 Replies)
Discussion started by: gmenfan83
8 Replies

9. Shell Programming and Scripting

How to block first bash script until second bash script script launches web server/site?

I'm new to utilities like socat and netcat and I'm not clear if they will do what I need. I have a "compileDeployStartWebServer.sh" script and a "StartBrowser.sh" script that are started by emacs/elisp at the same time in two different processes. I'm using Cygwin bash on Windows 10. My... (3 Replies)
Discussion started by: siegfried
3 Replies

10. UNIX for Beginners Questions & Answers

In Bash shell - the ps -ef shows only the /bin/bash but the script name is not displayed

In Bash shell - the ps -ef shows only the /bin/bash but the script name is not displayed ? Is there any way to get the script names for the process command ? --- Post updated at 08:39 AM --- in KSH (Korn Shell), my command output shows the script names but when run in the Bash Shell... (3 Replies)
Discussion started by: i4ismail
3 Replies
ZGREP(1)						      General Commands Manual							  ZGREP(1)

NAME
zgrep - search possibly compressed files for a regular expression SYNOPSIS
zgrep [ grep_options ] [ -e ] pattern filename... DESCRIPTION
Zgrep is used to invoke the grep on compress'ed or gzip'ed files. All options specified are passed directly to grep. If no file is speci- fied, then the standard input is decompressed if necessary and fed to grep. Otherwise the given files are uncompressed if necessary and fed to grep. If zgrep is invoked as zegrep or zfgrep then egrep or fgrep is used instead of grep. If the GREP environment variable is set, zgrep uses it as the grep program to be invoked. For example: for sh: GREP=fgrep zgrep string files for csh: (setenv GREP fgrep; zgrep string files) AUTHOR
Charles Levert (charles@comm.polymtl.ca) SEE ALSO
grep(1), egrep(1), fgrep(1), zdiff(1), zmore(1), znew(1), zforce(1), gzip(1), gzexe(1) ZGREP(1)
All times are GMT -4. The time now is 09:11 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy