Sponsored Content
Full Discussion: Issues with awk and tcsh
Top Forums Shell Programming and Scripting Issues with awk and tcsh Post 302739357 by maverick_here on Tuesday 4th of December 2012 05:50:14 AM
Old 12-04-2012
Issues with awk and tcsh

Hello experts,

I have two files which I'm uploading. One is an awk script and other file acts as an input to the script via positional parameter.

awk -f intlmenu.awk jobsq.txt

This run fine in C shell on SCO OpenServer Release 5.0.7.

When I run it on Solaris 10 ( tcsh shell )

I get the following error

Code:
awk -f intlmenu.awk jobsq.txt

awk: string too long near line 103
awk: syntax error near line 103
awk: illegal statement near line 103
awk: newline in string near line 103

The 103 line in intlmenu script is as follows

Code:
 printf "echo \"Data File Start `head -1 %s.qca | awk -f /ychw/accts/firstlast.awk`  Datafile End `tail -1 %s.qca | awk -f /ychw/accts/firstlast.
awk` \" >>/tmp/$UETIME.txt  \n",project[i],project[i] >> OutFile

I suspect it is due to the c/tcsh shell's behavior since it complains about "Unmatched .".I have tried various combinations but have failed. Any help would be greatly appreciated.

The desired output is as follows

Code:
        [INTERVIEW LENGTH]
        SELECT ONE SURVEY
        ================

 1) /cati/meat/live/meatlive     2) /cati/bexp/live/bexplive
 3) /cati/fran/live/franlive     4) /cati/govt/live/govtlive
 5) /cati/deak/live/deaklive     6) /cati/mwir/live/mwirlive
 7) /cati/kely/live/kelylive     8) /cati/vcfn/live/vcfnlive
 9) /cati/melt/live/meltlive    10) /cati/msmi/live/msmilive
11) /cati/star/12w3/star12w3    12) /cati/star/boo3/starboo3
13) /cati/oztam/r12w4/main/rztm12w4     14) /cati/oztam/r12w4/ref/rztmref
15) /cati/oztam/r12w4/6ccb/rztm6ccb     16) /cati/oztam/r12w4/nesl/rztmnesl
17) /cati/oztam/r12w4/6unres/rztm6unr   18) /cati/oztam/12w4/main/oztm12w4

        NOW ENTER YOUR CHOICE

Thanks In advance

Last edited by maverick_here; 12-04-2012 at 06:58 AM.. Reason: Including the desired output
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Awk output issues.

I have the follwing code: awk '{print $1}' HITS #Searches HITS file column one. Column one is filenames awk '{print $2}' HITS | sort -n | wc -l #Searches HITS file and sorts numerically and outputs line count. column 2 is IP addresses awk... (4 Replies)
Discussion started by: amatuer_lee_3
4 Replies

2. AIX

Issues with AWK

Hi there I have written a ksh script on a Red Hat OS and the following extract works. awk '{if (NR != 1) {print $rec1_field }}' $file1 >> combined When I run the same script on an AIX OS, I get the following error. awk: 0602-562 Field $() is not correct. The input line number is 2. The... (12 Replies)
Discussion started by: alanp
12 Replies

3. UNIX for Dummies Questions & Answers

Awk Performance Issues

Hi All, I'm facing an issue in my awk script. The script is processing a large text file having the details of a number of persons, each person's details being written from 100 to 250 tags as given below: 100 START| 101klklk| ... 245 opr| 246 55| 250 END| 100 START| ... 245 pp| 246... (4 Replies)
Discussion started by: pgp_acc1
4 Replies

4. 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

5. UNIX for Dummies Questions & Answers

tcsh issues

HI, I am having strange issues with my tcsh shell. First, the "ln" command doesnt seem to work properly. I have a file "target" that is pointing to "file1". I cannot access file1 but that shouldnt matter. when I do this, ln -sf file2 target I get permission denied that I cannot access the... (1 Reply)
Discussion started by: sardare
1 Replies

6. UNIX for Dummies Questions & Answers

awk: issues for writing a script

%%%%% (7 Replies)
Discussion started by: lucasvs
7 Replies

7. Shell Programming and Scripting

Awk OFS issues

Hi Im trying to tidy up the output of a who command when it writes to a log, everything I've tried doesnt seem to work though, any help would be massively appreciated. Im using the awk command to set the OFS as tab. #!/bin/bash who >> /export/home/tjmoore/logusers awk -F 'BEGIN... (3 Replies)
Discussion started by: 02JayJay02
3 Replies

8. Shell Programming and Scripting

Awk OFS issues

Hi, Could anyone tell me what Im doing wrong here any help will be much appreciated #!/bin/bash ls -ltr /export/home/tjmoore > /export/home/tjmoore/log100 awk -F " " /export/home/tjmoore/log100 'BEGIN {OFS="\t";} {print $1,$2,$3,$4,$5, $6,$7,$8,$9;}' > /export/home/tjmoore/log1001 I... (9 Replies)
Discussion started by: 02JayJay02
9 Replies

9. UNIX for Dummies Questions & Answers

Tcsh command for assigning output of awk to variable

Hi I have a text file with 2 values and I am trying to assign each value to a variable and then write those to text files. So if the textfile is data.txt with 2 values x and y I want to assign mean=x, and stdev=y and then write these out in text files alongwith the id ($id has already been... (6 Replies)
Discussion started by: violin
6 Replies

10. Shell Programming and Scripting

Issues with executing awk

I am piping some output to awk and would like to print fields $1 $2 and $3 $4 only if they exist. Note the awk begins with awk '{print $NF " " since I want the last field printed first. (7 Replies)
Discussion started by: motdman
7 Replies
All times are GMT -4. The time now is 11:25 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy