creating file name from command line argument.
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix administration > creating file name from command line argument.




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    creating file name from command line argument.  
papu


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
05-23-06 06: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






[ Post a follow-up to this message ]



    Re: creating file name from command line argument.  
papu


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
05-23-06 06: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






[ Post a follow-up to this message ]



    Re: creating file name from command line argument.  
Barry Margolin


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
05-24-06 12:17 AM

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 ***





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 06:38 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register