how to call awk in a csh Program

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting how to call awk in a csh Program
# 1  
Old 11-22-2007
how to call awk in a csh Program

Hi Friends,
Could you pleas help me out..

I have an awk program which works fine while running it in the command prompt.
The awk program is
awk 'BEGIN {
format="head -%d M2_Sales_N01.txt |tail -%d >M2_Sales_N01_%02d.txt\n"
if (n==0)
}' M2_Sales_N01_count.txt >>M2_Sales_N01.csh

But mu requiremnt is to put this awk in a shell scripts ,let say xyz.csh
and then exexcute the xyz.csh.

I put the syntax of awk in xyz.csh. But when i do
$ csh xyz.csh
Following error is comming
$ csh xyz.csh
Unmatched '

Friends please help me..
Thanks in advance
# 2  
Old 11-23-2007

Kindly help me out!!
# 3  
Old 11-24-2007

Pllllllllllllllllz helpme out.
# 4  
Old 11-25-2007
1. You should not bump posts to get attention, pllllllllz.
2. You should not be using csh as a scripting shell. It blows.
3. You should not use a different shell on the command line when testing code for a shell script...the shells are not the same.
4. You must escape each EOL in csh, which does not support multi-line quoted values without them, i.e.,

echo '123

echo '123\

# 5  
Old 11-25-2007
Hi Gus2000,
Accroding to you , I have put / in the last of each line . Still It doesnot wotrk and coming with same error.

I have done the following way
created one abc.csh
awk 'BEGIN {\
format="head -%d M2_Sales_N01.txt |tail -%d >M2_Sales_N01_%02d.txt\n"\
if (n==0)\
}' M2_Sales_N01_count.txt >>M2_Sales_N01.csh

$$ csh abc.csh
Unmatched '

Please suggest me how to over come this.
# 6  
Old 11-25-2007
I did make a suggestion..."don't use csh".

I even tried this and didn't get the error, so you either have whitespace after one or more backslashes (which defeats them) or your version of csh is even crappier than mine.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Homework & Coursework Questions

Help with Execl system call in a C program?

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: "Your a7.c program should use printf to print a nice message. (You can decide what to say.) Then the process... (9 Replies)
Discussion started by: miniviking10
9 Replies

2. Programming

call program

I would need to call the program 'ethtool' in my C++ program, does anyone know how to do that (if its even possible)? (1 Reply)
Discussion started by: Freaky123
1 Replies

3. Shell Programming and Scripting

Selecting files from a list and passing them to a program using csh

I have a list of files, example as shown below n02-z30-dsr65-ndelt0.25-varp0.002-4x3drw-csq.msf n02-z30-dsr65-ndelt0.25-varp0.004-4x3drw-csq.msf n02-z30-dsr65-ndelt0.25-varp0.006-4x3drw-csq.msf n02-z30-dsr65-ndelt0.25-varp0.008-4x3drw-csq.msf... (8 Replies)
Discussion started by: kristinu
8 Replies

4. Shell Programming and Scripting

Running a program using csh

I have a program which I can run on the command line like below and works fine /nethome/chrisd/HSeis/TommyCD/TommyCD-1101/bin/raytrac vmod=npt10-z30.vmod rcfile=jcdint.rc phases="SP FS" level=twop format="X T" dtau=0.1 mdacc=0.5 mindist=0.1 maxitertp=25 ray=npt10-z30.ry... (0 Replies)
Discussion started by: kristinu
0 Replies

5. Shell Programming and Scripting

Call a mainframe program

Is it possible to call a mainframe program in UNIX script. I am using HP-UNIX. If so can any let me know the way to do it. (1 Reply)
Discussion started by: atlantis
1 Replies

6. Programming

how to call c executable inside c program??

hi guys i have only basic knowledge of c so guys plz help me ..... i want 2 call c executable which requires file name as argument and i need to modify file contents before calling that executable now my question is how can i call this c executable inside another c program with arguments ?? i... (9 Replies)
Discussion started by: zedex
9 Replies

7. Shell Programming and Scripting

Call C Program From Shell Script

Hi, Could anybody please let me know how to call a C_Program from shell script. I know through command "system" we can call shell script from C program. Awaiting response. Thanks and regards, Chanakya M (4 Replies)
Discussion started by: Chanakya.m
4 Replies

8. Shell Programming and Scripting

how to call another program

Hi, I would like to know how to call a program "cmp_size" ... where to put in progam to run it ex: program checkdisk is below, and it will call a nother problem "cmp_size" Do I just put the cmp_size program at the end of this program. Thank you very much, # check all directory for size... (3 Replies)
Discussion started by: xitrum
3 Replies

9. Shell Programming and Scripting

csh failing to call an 2 embedded csh script

I have an extraordinary problem with a csh script.....(feel free to berate the use of this but I'm modifying an existing bunch of them) Anyway, I have a master csh script which in turn calls a second csh script. This second csh script is below. Within this second script are two compiled C++... (1 Reply)
Discussion started by: pollsizer
1 Replies

10. Linux

How to call a proc file from *.c program?

Hi, I am new to Linux programming. As part of learning, I need to create a *.c program where we call certain /proc files (i.e. such as meminfo, version, uptime, etc...) from our program. Can anyone point me to a simple program on how one would do this (i.e. can you directly call uptime() or... (4 Replies)
Discussion started by: pat_and_cami
4 Replies
Login or Register to Ask a Question