Getting err with 'awk' command


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Getting err with 'awk' command
# 1  
Old 06-08-2009
Getting err with 'awk' command

Hi All,

I am trying to run the below cmd thro' a script.

awk 'NR>=48&&NR<=(58-1)' $IN_FILE_NAME | tee $OUT_FILE_NAME

but I am getting an err while running the script. It gives the below err msg :
awk: syntax error near line 1
awk: bailing out near line 1

(P.S Note: When run the above command manually, it works fine. But I am facing this pb only when I run thro' script.)

Pls help me to resolve this issue.

Thanks in advance
Saravana
# 2  
Old 06-08-2009
there is no error in the code but if you running it from a script it is better you put the absolute path of the innput and output files.
BR
# 3  
Old 06-08-2009
Yes, I am giving absolute path for both IN_FILE_NAME and OUT_FILE_NAME.
like this :
awk 'NR>=39&&NR<=41' /export/home/sa156s/RdsTestClient.java | tee /tmp/align.11557

but still facing the same pb.
# 4  
Old 06-08-2009
The same work's fine even in script .

Check your script for any special characters that my be added accidentally.
# 5  
Old 06-08-2009
ok; if you have solaris put the awk full path which is :-

/usr/xpg4/bin/awk or do "which awk" command and take the path you get and put it in the script instead of awk (take absolute path to awk).

BR
# 6  
Old 06-08-2009
If on Solaris, use /usr/bin/nawk or /usr/xpg4/bin/awk
# 7  
Old 06-09-2009
vgersh99,
yes you are correct....... "nawk" works fine in my machine.

Thanks all
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Solaris

I/O error Err#5 EIO

Hi gurus, My Solaris version is Solaris 10 1/06 s10s_u1wos_19a SPARC Im getting I/O error while trying to ls -l a directory in Solaris SPARC box the truss output from server is attached below truss -fall -vall -wall -rall ls -la 12278/1: acl("./dat", GETACLCNT, 0,... (3 Replies)
Discussion started by: Solaris_Begin
3 Replies

2. Shell Programming and Scripting

Script to monitor for new file with ext .err and size > 0 bytes and perform a action or command

Hi All, I need to create a script to monitor a dir for new files with ext .err and also it should b a non empty files. and perform a action or command . We have a new ETL application that runs on a linux server, every times a etl fails it creates a .err file or updates the existing .err... (4 Replies)
Discussion started by: MAKHAN
4 Replies

3. Shell Programming and Scripting

Ksh script: std Out/err

Hello gurus, this is part of my script: ls -1 ${MyFile} >> ${dir_log}ListFile${Now}.tmp FILENUM=`cat ${dir_log}ListFile${Now}.tmp| wc -l | awk '{print $1}'`>> /dev/null if then writeError "ERRORE: no file in directory for type ${FileName}!" >> ${LogFileName} Close 1 fi... (7 Replies)
Discussion started by: GERMANICO
7 Replies

4. Shell Programming and Scripting

awk command in script gives error while same awk command at prompt runs fine: Why?

Hello all, Here is what my bash script does: sums number columns, saves the tot in new column, outputs if tot >= threshold val: > cat getnon0file.sh #!/bin/bash this="getnon0file.sh" USAGE=$this" InFile="xyz.38" Min="0.05" # awk '{sum=0; for(n=2; n<=NF; n++){sum+=$n};... (4 Replies)
Discussion started by: catalys
4 Replies

5. Shell Programming and Scripting

Phrasing err ssh...

hi.... below cmd (to get current hour - 1) works in localhost...whereas to get the same value in remote host..no result.. looks some pharsing error...can someone help? $ date Monday, 3 May 2010 09:15:46 GMT $ perl -e 'print "" . localtime(time()-$ARGV) . "\n";' 3600 Mon May 3 08:15:57... (1 Reply)
Discussion started by: id100
1 Replies

6. Shell Programming and Scripting

Syntax err near unexpected token...

I've been looking at this code too long. Maybe a fresh set of eyes can spot the: "syntax error near unexpected token `(' ./phmenu ` tput cup 18 4: echo "Accept? (y) es or (n)o: " This is the line in the code: tput cup 18 4; echo "Accept? (y)es or (n)o: " Thanks In Advance... (3 Replies)
Discussion started by: Ccccc
3 Replies

7. Shell Programming and Scripting

sccs get -ek command is throwing err

Hi, get -ek s.Communicator.java The difference between the current date and the creation date of the newest delta in the SCCS file is greater than 1 year. Make sure that the system date is set correctly. This message is only a warning. (co11) 14.3 ... (0 Replies)
Discussion started by: Shivaprasad BS
0 Replies

8. Shell Programming and Scripting

Err while using find command

hi frnds, I have written a script as follows. ssh username@servername "find $1 -type f -name $2 -mtime +1 -exec rm '{}' \;" when i excute tis script i get error FIND: Parameter format not correct parameter 2 is the file name .. . Thx in advance (6 Replies)
Discussion started by: vikramsnest
6 Replies

9. UNIX for Dummies Questions & Answers

tar write err

This isn't causing me a problem, but it is puzzling (& slightly worrying) me. If I use tar to copy to a tape & the tape is write protected, I only get the message 'tar: tape write err' if there are a few files to copy. eg. # tar cvf /dev/rStp4 /usr/data will produce the messages ... (4 Replies)
Discussion started by: Kevin Pryke
4 Replies
Login or Register to Ask a Question