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
KEXTSTAT(8)						    BSD System Manager's Manual 					       KEXTSTAT(8)

NAME
kextstat -- display status of dynamically loaded kernel extensions SYNOPSIS
kextstat [-b kext_bundle_id] [-k] [-l] DESCRIPTION
The kextstat utility displays the status of any kernel extensions currently loaded in the kernel. The following information is shown for each loaded kernel extension: Index The load index of the kernel extension (used to track references). Gaps in the list indicate kernel extensions that have been unloaded. Refs The number of references to this extension by others. If nonzero, the extension cannot be unloaded. Address The address in kernel space where the extension has been loaded. Size The number of bytes of kernel memory that the extension occupies. If this is zero, the extension is actually a built-in part of the kernel that has a record as an extension for resolving dependencies among extensions. Wired The number of wired bytes of kernel memory that the extension occupies. Name The CFBundleIdentifier of the kernel extension. (Version) The CFBundleVersion of the kernel extension. <Linked Against> The index numbers of all other kernel extensions that this extension has a reference to. The following options are available: -b kext_bundle_id Display the status of only the kernel extension with the given bundle identifier. This option trumps the -k option; if both are given and a kernel component is specified, its information is shown. -k Don't show information for built-in components of the kernel. -l Print the list of loaded kexts only and omit the header (useful for running output through text-analysis tools). DIAGNOSTICS
The kextstat utility exits with a status of 0 on success and with a nonzero status if an error occurs. SEE ALSO
kextcache(8), kextd(8), kextload(8), kextunload(8) HISTORY
The kextstat command is based on the command kldstat written by Doug Rabson <dfr@FreeBSD.org> Darwin April 17, 2002 Darwin
All times are GMT -4. The time now is 08:29 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy