Unix administration - creating file name from command line argument.

This is Interesting: Free IT Magazines  
Home > Archive > Unix administration > May 2006 > creating file name from command line argument.





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author creating file name from command line argument.
papu

2006-05-23, 1:17 pm

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

papu

2006-05-23, 1:17 pm

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

Barry Margolin

2006-05-23, 7:17 pm

In article <1148399536.398747.267470@j33g2000cwa.googlegroups.com>,
"papu" <prachar@gmail.com> 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 ***
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com