Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Awk > Re: AWKPATH que...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 4 of 7 Topic 2210 of 2317
Post > Topic >>

Re: AWKPATH question

by twf_cc <twfccc@[EMAIL PROTECTED] > Mar 29, 2008 at 07:22 AM

On 3$B7n(B29$BF|(B, $B>e8a(B11$B;~(B59$BJ,(B, Ed Morton
<mor...@[EMAIL PROTECTED]
> wrote:
> On 3/28/2008 10:56 PM, twf_cc wrote:
>
>
>
> > I have set enviroment AWKPATH in ~/.bash_profile including ~/lib/awk
> > which contains some function
> > at command line using, there's no problem.
> > fang@[EMAIL PROTECTED]
 ~
> > $ uname -a
> > CYGWIN_NT-5.1 bash 1.5.25(0.156/4/2) 2008-03-05 19:27 i686 Cygwin
>
> > fang@[EMAIL PROTECTED]
 ~
> > $ echo $AWKPATH
> > /usr/lib/awk:/home/fang/lib/awk
>
> > fang@[EMAIL PROTECTED]
 ~
> > $ echo abcd |awk -f reverse.awk  --source '{print reverse($0)}'
> > dcba
>
> > put in a file ,I get an error
>
> > fang@[EMAIL PROTECTED]
 ~
> > $ cat junk
> > #! /bin/gawk -f reverse.awk --source
>
> >   {
> >    print reverse($0)
> >   }
>
> > fang@[EMAIL PROTECTED]
 ~
> > $ echo abcd |./junk
> > gawk: fatal: can't open source file ` reverse.awk --source ' for
> > reading (No such file or directory)
>
> > calling gawk from shell, there's no problem
>
> > $ cat junk2
> > #! /bin/bash
>
> > gawk -f reverse.awk --source '{print reverse($0)}'
>
> > fang@[EMAIL PROTECTED]
 ~
> > $ echo abcd | ./junk2
> > dcba
>
> > how to solve the problem, thanks
>
> You probably haven't ex****ted AWKPATH. This is more of an OS-specific
issue and
> so is OT here so follow up at comp.unix.shell if that's not it.
>
>         Ed.

I have ex****t enviroment var in bash_profile

fang@[EMAIL PROTECTED]
 ~
$ cat .bash_profile | tail -n6
ex****t NNTPSERVER='freenews.netfront.net'
ex****t LYNX_CFG="$HOME/lynx.cfg"
ex****t LESSCHARSET=latin1
#ex****t LC_CTYPE=zh_CN.gbk
ex****t CHARSET=GBK
ex****t AWKPATH="/usr/lib/awk:$HOME/lib/awk"

fang@[EMAIL PROTECTED]
 ~
$ pwd
/home/fang

fang@[EMAIL PROTECTED]
 ~
$ unset AWKPATH

fang@[EMAIL PROTECTED]
 ~
$ echo $AWKPATH


fang@[EMAIL PROTECTED]
 ~
$ source .bash_profile

fang@[EMAIL PROTECTED]
 ~
$ echo $AWKPATH
/usr/lib/awk:/home/fang/lib/awk

fang@[EMAIL PROTECTED]
 ~
$ pwd
/home/fang

fang@[EMAIL PROTECTED]
 ~
$

fang@[EMAIL PROTECTED]
 ~
$ echo abcd | gawk -f reverse.awk --source '{print reverse($0)}'
dcba

fang@[EMAIL PROTECTED]
 ~
$ cat junk
#! /bin/gawk -f reverse.awk --source
 {
  print reverse($0)
 }

fang@[EMAIL PROTECTED]
 ~
$ echo abcd | ./junk
gawk: fatal: can't open source file ` reverse.awk --source' for
reading (No such file or directory)

fang@[EMAIL PROTECTED]
 ~
$

any ideas? thanks
 




 7 Posts in Topic:
AWKPATH question
twf_cc <twfccc@[EMAIL   2008-03-28 20:56:07 
Re: AWKPATH question
Ed Morton <morton@[EMA  2008-03-28 22:59:42 
Re: AWKPATH question
"Rajan" <svr  2008-03-29 01:46:51 
Re: AWKPATH question
twf_cc <twfccc@[EMAIL   2008-03-29 07:22:46 
Re: AWKPATH question
Ed Morton <morton@[EMA  2008-03-29 09:25:20 
Re: AWKPATH question
Steffen Schuler <schul  2008-03-29 17:05:58 
Re: AWKPATH question
stan <smoore@[EMAIL PR  2008-03-29 19:26:52 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Jul 26 2:35:01 CDT 2008.