Sponsored Content
Top Forums Shell Programming and Scripting AWK syntax /bailing script error when executing in UNIX Post 302501508 by rdcwayx on Thursday 3rd of March 2011 06:51:32 PM
Old 03-03-2011
Please provide the sample of search file and *.sas file, and also the expect O/P.

Now I have to guess, seems your system is solaris. need nawk.

all in one awk:

Code:
nawk 'NR==FNR{a[NR]=tolower($0);next}{ for ( i in a) {if (tolower($0) ~ a[i]) print a[i],$0}}' OFS="\t" search *.sas

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

-awk: bailing out near line 1

Hi I'm using cygwin and the script below works just fine under cygwin.. when i upload it on a unix server the script fails with the following errors -awk: syntax error near line 1 -awk: bailing out near line 1 any ideas why? thanx awk '($2 ~ /*/) { if ($4 < 40){ print... (3 Replies)
Discussion started by: kion
3 Replies

2. Shell Programming and Scripting

awk syntax error

mVar=0 count=`awk -F, '( ( $2 ~ /^GIVEUP$/ && $3 ~ /^NEW$/ ) || ( $2 ~ /^SPLIT$/ && $3 ~ /^NEW$/ ) || ( $2 ~ /^OPTION$/ && $3 ~ /^NEW$/ ) || ( $2 ~ /^OPTIONSPLIT$/ && $3 ~ /^NEW$/ ) ) { count++ } END { print count }' myCSV.csv myVar=`expr $myVar + $count` Can I do this? I get a syntax... (4 Replies)
Discussion started by: yongho
4 Replies

3. UNIX for Dummies Questions & Answers

awk Shell Script error : "Syntax Error : `Split' unexpected

hi there i write one awk script file in shell programing the code is related to dd/mm/yy to month, day year format but i get an error please can anybody help me out in this problem ?????? i give my code here including error awk ` # date-month -- convert mm/dd/yy to month day,... (2 Replies)
Discussion started by: Herry
2 Replies

4. Shell Programming and Scripting

How to Check Shell script syntax w/o executing

Hello All, I looking for a way to verify the correction of shell script syntax. Is there any switch like -c in perl which do this in shell ? Thank You. (1 Reply)
Discussion started by: Alalush
1 Replies

5. Shell Programming and Scripting

Awk and read bailing out

Hi All, Can some body help me in this to work #!/bin/ksh nof=`wc -l outFile_R.out | sed -e 's/*//g' ` no_of_lines=`expr $nof - 0` z=1 while ] do cat outFile_R.out | awk -v I="$z" 'NR==I { print $0 }' | read from_date to_date id echo "executing $from_date... (2 Replies)
Discussion started by: sol_nov
2 Replies

6. Answers to Frequently Asked Questions

awk: bailing out

If you see this: awk: syntax error near line 1 awk: bailing out near line 1 Chances are you are working on Solaris and you are using standard awk. If so, you need to use /usr/xpg4/bin/awk instead, which is POSIX awk (or nawk if that is not available). (1 Reply)
Discussion started by: Scrutinizer
1 Replies

7. Shell Programming and Scripting

Syntax Error in Unix Shell Script

I am trying to run a unix script in my home directory.Snippet below echo "`date '+%Y%m%d_%H%M%S'` Getting ProductList.dat" if ( -f $DIR/ProductList.dat) then cp $DIR/ProductList.dat MigratedProductList.dat else echo "`date '+%Y%m%d_%H%M%S'`ProductList.dat does not exist; Processing... (4 Replies)
Discussion started by: Mary James
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

Isql syntax error in UNIX script

Hello Everyone, Coming again for your help to solve the below error: In a script, i had created a temp table (Temp_table) and loaded the data in it using bcp command (performed successfully) and I wanted to move it to the preferred table (called Main_table) for further use. hence I have added... (1 Reply)
Discussion started by: Suresh
1 Replies

10. UNIX for Advanced & Expert Users

Isql and If Exist syntax error in UNIX script

Hello Everyone, Coming again for your help to solve the below error: In a script, i had created a temp table (Temp_table) and loaded the data in it using bcp command (performed successfully) and I wanted to move it to the preferred table (called Main_table) for further use. hence I have added... (7 Replies)
Discussion started by: Suresh
7 Replies
tolower(3C)						   Standard C Library Functions 					       tolower(3C)

NAME
tolower - transliterate upper-case characters to lower-case SYNOPSIS
#include <ctype.h> int tolower(int c); DESCRIPTION
The tolower() function has as a domain a type int, the value of which is representable as an unsigned char or the value of EOF. If the argument has any other value, the argument is returned unchanged. If the argument of tolower() represents an upper-case letter, and there exists a corresponding lower-case letter (as defined by character type information in the program locale category LC_CTYPE), the result is the corresponding lower-case letter. All other arguments in the domain are returned unchanged. RETURN VALUES
On successful completion, tolower() returns the lower-case letter corresponding to the argument passed. Otherwise, it returns the argument unchanged. ERRORS
No errors are defined. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ |ATTRIBUTE TYPE |ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |CSI |Enabled | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ SEE ALSO
_tolower(3C), setlocale(3C), attributes(5), standards(5) SunOS 5.11 14 Aug 2002 tolower(3C)
All times are GMT -4. The time now is 02:15 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy