creating file name from command line argument. - Unix

This is a discussion on creating file name from command line argument. - Unix ; Hello, I am using sql as alias to run db2 command in ksh shell. alias sqllog="apply 'db2 -tvf %1 > %1.log'" This command adds .log to foo1.sql. Please give me a solution to replace .sql with .log Thanks Papu...

+ Reply to Thread
Results 1 to 3 of 3

Thread: creating file name from command line argument.

  1. creating file name from command line argument.

    Hello,

    I am using sql as alias to run db2 command in ksh shell.
    alias sqllog="apply 'db2 -tvf %1 > %1.log'"
    This command adds .log to foo1.sql.

    Please give me a solution to replace .sql with .log

    Thanks
    Papu


  2. Re: creating file name from command line argument.

    I tried sed below. It doesn't give me error
    alias sqllog="apply 'db2 -tvf %1 > sed s/sql/log/ %1' " . Can someone
    point out where I am going wrong. Thanks.
    Papu


  3. Re: creating file name from command line argument.

    In article <1148399536.398747.267470@j33g2000cwa.googlegroups. com>,
    "papu" wrote:

    > Hello,
    >
    > I am using sql as alias to run db2 command in ksh shell.
    > alias sqllog="apply 'db2 -tvf %1 > %1.log'"
    > This command adds .log to foo1.sql.
    >
    > Please give me a solution to replace .sql with .log


    Aliases don't do parameter substitution, use a function.

    --
    Barry Margolin, barmar@alum.mit.edu
    Arlington, MA
    *** PLEASE post questions in newsgroups, not directly to me ***
    *** PLEASE don't copy me on replies, I'll read them in the group ***

+ Reply to Thread