Sponsored Content
Top Forums Shell Programming and Scripting Changing file extension in csh alias Post 302706963 by ygmwayne on Thursday 27th of September 2012 07:15:05 PM
Old 09-27-2012
Changing file extension in csh alias

I want to type only the filename of a gcc source that has ".syn" as an extension and copy it, changing the extension to ".c" so it can be compiled.
I do it as follows:
Code:
     if (-e $1.syn) then
     /bin/cp $1.syn $1.c
     endif

This works fine, but if I want to repeat the compilation by recovering the previous call using history, the full filename plus the extension ".syn" appears and I have to delete the ".syn" to use my script.

Because so many programs give one an option of typing a filename with or without an ext, there must be a simple way to do this. How is it done?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Changing extension

Hi , I need to replace the file name extension with txt to csv,i wrote the below script when executing its giving the below error.Please anyone how to do this? $ a2.sh mv: *.: cannot access: No such file or directory ./a2.sh: o: bad number $ vi a2.sh a2.sh ----- #!/bin/ksh txt=$1... (4 Replies)
Discussion started by: mohan705
4 Replies

2. Shell Programming and Scripting

CSH - finding files with the same file extension

Hey, I'm having a problem finding out if a directory holds any files with a certain file extension, for example .txt. I have tried: if (! -e "*.txt") and I've tried: set FILES=`ls *` echo "Found $FILES" foreach FILE ($FILES) if($FILE == "*.txt") And neither of... (2 Replies)
Discussion started by: amnesiaiom
2 Replies

3. UNIX for Dummies Questions & Answers

Changing the extension of the file

I have a list of files in a particular folder Example: File name - sample.F1.test I want to change the extension of the above file to .csv The final file should be renamed as sample.csv (4 Replies)
Discussion started by: mazhar803
4 Replies

4. Shell Programming and Scripting

alias in CSH

Hello guys, I want to use an alias as an sub function in the script. Here is my issue: I want to use exsit_en <pattern> <file> to indicate that if the <file> contains <pattern> the expression returns 1, and vice versa. But in the alias I used as follows, the $status alway is 0. Can someone... (3 Replies)
Discussion started by: tpltp
3 Replies

5. Shell Programming and Scripting

changing filename extension

Hi All, i need to change the filename extension. For simplicity, we can assume that the extension after '.' is 3 characters only... but the filenames can vary. eg. changing from abc.doc to abc.dxs can i have a oneline command to achieve this (3 Replies)
Discussion started by: Hiso
3 Replies

6. UNIX for Dummies Questions & Answers

changing file extension

Hello, everyone! :] I'm having an issue with my camera/uploading to Photobucket. When my camera transfers it's photos to my hard drive, it transfers them as .JPG. Unfortunately, when I go to upload to my Photobucket account, it only accepts .jpg & .jpeg files. Every time I want to upload, I... (6 Replies)
Discussion started by: spidydude
6 Replies

7. Shell Programming and Scripting

Csh script get file extension

Hi All I have a csh shell script which should check if a given file is a zip file as below: **************************************** #!/bin/csh -f if ]; then echo is a zip file else echo sorry not a zip file endif exit **************************************** ... (1 Reply)
Discussion started by: raj144
1 Replies

8. UNIX for Dummies Questions & Answers

Changing file extension

Hello all, I need to change file extension for all .doc files to .txt file in multiple folders. I know the way to rename them by going to each folder and doing that, but I need something which I can run from home directory so that It does the renaming in all the nested directories. Thanks. (4 Replies)
Discussion started by: jaysean
4 Replies

9. Shell Programming and Scripting

Changing the file name to a different one using csh

I have a file name n10-z30-dsr65-ndelt1.00-varp0.08-16x12drw-csq-msf.ps and I want to remove the varp info tag to get n10-z30-dsr65-ndelt1.00-16x12drw-csq-msf.ps Trying to use tr, but when I tried replacing varp with ooo I am getting the results below: echo... (2 Replies)
Discussion started by: kristinu
2 Replies

10. Debian

Changing file extension names

Hi I have a list of files :root@L28mustang:/var/log/exim4/2017/Jul2017_Blast_BC07# ls -lrt | grep mainlog -rw-r----- 1 Debian-exim adm 3636932 Jul 8 06:25 mainlog.3.gz -rw-r----- 1 Debian-exim adm 919512 Jul 9 06:27 mainlog.2.gz -rw-r----- 1 Debian-exim adm 7655054 Jul 10 06:25 mainlog.1... (1 Reply)
Discussion started by: anaigini45
1 Replies
TclXSLT(n)																TclXSLT(n)

__________________________________________________________________________________________________________________________________________________

NAME
::xslt::compile - SYNOPSIS
package require xslt xslt2.5 ::xslt ::xslt::compile doc ssheet method ? option value ... ? ? args ... ? ::xslt::extensionadd nsuri tcl-namespace _________________________________________________________________ DESCRIPTION
TclXSLT is a wrapper for the that allows an application to perform XSL transformations (XSLT). The package also provides a binding to the XSLT extension mechanism so that XSLT extension may be implemented using Tcl scripts. Transformation only works with documents created by TclDOM/libxml2. The TclXSLT package makes extensive use of Tcl objects. Compiled XSL stylesheets are stored as the internal representation of a Tcl object. Source and result documents are accessed via TclDOM's C interface as Tcl objects. This allows the application to cache parsed XML documents and compiled XSL stylesheets for better runtime performance. PACKAGES AND NAMESPACES
The TclXSLT package defines the package and also a Tcl namespace using that name. COMMANDS
::xslt::compile The ::xslt::compile command pre-compiles a stylesheet document. It returns a compiled stylesheet object and also defines a Tcl command to access the stylesheet. This Tcl command may be used to transform XML documents. NB. It is advisable to use the -baseuri option when parsing the source and stylesheet documents to allow external resources to be resolved. Stylesheet Command The stylesheet command created by ::xslt::compile command accesses a compiled stylesheet. Following is an example of how to use the stylesheet transform method. Command Methods The following command methods may be used: cget option Returns the value of an option. See below for the list of valid options. configure optionvalue Sets the value of an option. Available options are as follows: transform source ? name value? Performs an XSL transformation on the given source document. Stylesheet parameters may be specified as name-value pairs. The return result is the DOM token for the result document. Stylesheet Parameters Any number of name-value pairs may be specified as arguments to the stylesheet transform method. These are passed as values for parameters in the stylesheet. interprets the values as XPath expressions, where the context node is the root node for the source document. To pass a value as a string it must be XPath-quoted, for example set library "Gnome libxslt" $ssheet transform $source_doc library '$library' author "'Daniel Veillard'" node {/*/Element[3]} ::xslt::extension The ::xslt::extension command is used to manage extensions of the library. The add is used to register an extension. The remove is used to unregister an extension. See for more detail. EXTENSIONS
The TclXSLT package allows an application to bind Tcl scripts to the extension mechanism of . This means that Tcl scripts may provide the implementation of an XSLT extension element or function. The binding is achieved to associating a Tcl namespace with an XML namespace. Implementing An Extension The Tcl application uses the ::xslt::extension add command to register an extension. An XML Namespace for the extension is specified as an argument, along with a Tcl namespace that will provide implementations of extension elements and functions. For example, Everytime the ::xslt::transform command is executed, a newly-created XSLT engine is initialized. For each registered extension, every pro- cedure in the associated Tcl namespace is defined in the XSLT engine as either an extension element or an extension function. The proce- dure is defined as an extension function if it has a variable argument list, otherwise it is defined as an extension element. The proce- dure name is used as the local part of the extension name. For example, "myfunc" is defined as an extension function and "myelement" is defined as an extension element. Extension Functions The arguments to an extension function are converted to a string value and then passed as parameters to the Tcl procedure. The return result of the Tcl procedure becomes the return value of the extension function. The type of the result is preserved where possible, otherwise it is converted to a string value. Extension Elements Extension elements have not been implemented in TclXSLT v1.1. Using An Extension To invoke an extension in an XSL stylesheet, use the normal XSLT extension mechanism. The XML Namespace matches the extension to the reg- istered Tcl namespace (NB. the stylesheet author is free to choose any prefix for the extension namespace). For example, This stylesheet would result in the following Tcl script being evaluated: Tcl Built-In Commands Tcl TclXSLT(n)
All times are GMT -4. The time now is 08:43 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy