Help for a newby


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help for a newby
# 1  
Old 05-04-2005
Data Help for a newby

I am new to using nawk. When I put the following line in script file test1.awk
I get the results:

{ print NR, length($0),NF}

>nawk -f test1.awk head.txt

1 63 5
2 2622 188
3 2166 155
4 3192 228
5 2679 192
.....

but if I modify the test1.awk file to look like this:
BEGIN {FS = ","}
{ print NR, length($0),NF}

when if do:
>nawk -f test1.awk head.txt

I get

nawk: syntax error at source line 1
context is
<<< BEGIN {FS = >>> ","}
nawk: bailing out at source line 1

I have tried many combinations o single quotes, no quotes with the same result.

Any Idea Why???
# 2  
Old 05-04-2005
works just fine on Solaris.
make sure you don't have any control characters in the awk file.
# 3  
Old 05-04-2005
I was using Notepad and accessing the directory through a mapped drive in explorer and Bingo, you were right! there was a ^M character at the end of the first line. As soon as I removed it. It worked

Thanks!

Now back to the learning phase!!
Login or Register to Ask a Question

Previous Thread | Next Thread

3 More Discussions You Might Find Interesting

1. Fedora

Newby: How to actually update software?!

Hi All - 1) I work with bigdate for a living, use lots of neat software, SAS, SQL Server, etc. I know how to get my data and such, analyze it, etc... 2) I use UNIX at work (Solaris mostly) and can easily navigate around Unix and get the job done, vi and sas -nodms are about my fav, and some... (6 Replies)
Discussion started by: sas
6 Replies

2. Shell Programming and Scripting

Newby needs help from an OpenSSL expert

Dear friends, Thank you for reading this post. Please download files here: http://www.idanfe.com/dl/files.zip This is my problem: I have to sign a file like my teste1.txt One sample signed file is example.txt I am also including a private key I generated called... (4 Replies)
Discussion started by: fundidor
4 Replies

3. Homework & Coursework Questions

Make file newby question

1. The problem statement, all variables and given/known data: I'm brand new to make files, and I was hoping someone could tell me where I'm messing up. I'm trying to build a cpp program I wrote for class on a linux system, i'm using winscp and puTTy. The program works fine when I build it... (3 Replies)
Discussion started by: Casper3912
3 Replies
Login or Register to Ask a Question