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
DROP 
EXTENSION(7) PostgreSQL 9.2.7 Documentation DROP EXTENSION(7) NAME
DROP_EXTENSION - remove an extension SYNOPSIS
DROP EXTENSION [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ] DESCRIPTION
DROP EXTENSION removes extensions from the database. Dropping an extension causes its component objects to be dropped as well. You must own the extension to use DROP EXTENSION. PARAMETERS
IF EXISTS Do not throw an error if the extension does not exist. A notice is issued in this case. name The name of an installed extension. CASCADE Automatically drop objects that depend on the extension. RESTRICT Refuse to drop the extension if any objects depend on it (other than its own member objects and other extensions listed in the same DROP command). This is the default. EXAMPLES
To remove the extension hstore from the current database: DROP EXTENSION hstore; This command will fail if any of hstore's objects are in use in the database, for example if any tables have columns of the hstore type. Add the CASCADE option to forcibly remove those dependent objects as well. COMPATIBILITY
DROP EXTENSION is a PostgreSQL extension. SEE ALSO
CREATE EXTENSION (CREATE_EXTENSION(7)), ALTER EXTENSION (ALTER_EXTENSION(7)) PostgreSQL 9.2.7 2014-02-17 DROP EXTENSION(7)
All times are GMT -4. The time now is 09:58 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy