Sponsored Content
Full Discussion: cut filename extension
Top Forums Shell Programming and Scripting cut filename extension Post 302440852 by pravin27 on Wednesday 28th of July 2010 03:31:00 PM
Old 07-28-2010
Code:
f=testfile.txt ; a=`basename $f ".txt"` ;echo $a

This User Gave Thanks to pravin27 For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

filename extension check - regular expression

How to compare the file name for "zip" or "ZIP" extension. I can put one more || condition to check the upper case in the below: if ]; then Is there any better way to compare using regular expressions. Thx in advance. (4 Replies)
Discussion started by: devs
4 Replies

2. Shell Programming and Scripting

separating filename and extension

Hi (warning: newbie question), I am writing a script to run a series of tests on a program, which involves a line: for file in `ls test_suite/*.args` but later I want to send the output to file.out. But I need to separate the filename and extension somehow...Also $file contains... (2 Replies)
Discussion started by: lucaspewkas
2 Replies

3. 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

4. UNIX for Dummies Questions & Answers

script takes the whole filename instead of just extension

I am running my script from "/abc/" this path and it has no ".csv files" but has a ".txt" files namely temp1.txt My script goes as below, wherein it is suppose to find files with *.txt extension and *.csv extension in another path namely "/abc/xyz/": #!/bin/ksh PATH1="/abc/xyz/" value="*.csv... (1 Reply)
Discussion started by: wolverine999
1 Replies

5. Shell Programming and Scripting

Getting filename with entire path without extension

Hi Experts, need one help.. m writing a shell script for which i need the entire path of the file but without its extension. running the below script gives error at the statement DIR = `dirname $FILE` --command not found. #!/bin/bash jar xvf *jar for FILE in `find . -name "*.class"` ... (3 Replies)
Discussion started by: amicableperson
3 Replies

6. Shell Programming and Scripting

removing the filename extension

Is there an easy way to strip off a filename's extension? For example, here's a filename: blahblahblah.thisisok.thisisnotok I want to get rid of .thisisnotok from the filename, so that what's left is blahblahblah.thisisok Thanks. I have a directory full of filenames that need to be... (5 Replies)
Discussion started by: daflore
5 Replies

7. Shell Programming and Scripting

Script to add extension to filename

Hi all, I have a folder with a bunch of files in them, and I would like to add an extension (.mp3)to all these filenames. The folder has only files that I'd like .mp3 added to. It looks something like this: Intput: File1 File2 File3Output: File1.mp3 File2.mp3 File3.mp3Thanks in... (2 Replies)
Discussion started by: repiv
2 Replies

8. Shell Programming and Scripting

Rename all files (filename with spaces) to different extension

Hi, I have files with filenames as below. SGM Daily Sales Email-en-us-05312012.xlwa I want to rename it in .xls. I am writing a script to change this, as there can be multiple files in subfolders. I have the following script. #!/bin/ksh for oldfile in $(find... (1 Reply)
Discussion started by: mac4rfree
1 Replies

9. Shell Programming and Scripting

Get latest filename without extension

I need to write a shell script to display the output of ls command like this ls -ltr *txt I get this -rw-r----- 1 oracle dba 51912704 Dec 11 10:27 /usr/local/sam/test12112012101247AM.txt -rw-r--r-- 1 oracle dba 7 Dec 11 11:58 /usr/local/sam/test.txt but I just need the latest... (7 Replies)
Discussion started by: sumang24
7 Replies

10. Shell Programming and Scripting

[BASH] Getting a filename its extension

Heyas As i often have decide things upon a filename its extension, i thought i'd write a script: Just wondering if there would be a more efficent way? out="" FN=$( echo "$1" | sed s," ","",g) # Remove any spaces and make it a single string for chance in $(echo "$FN"|sed s,"\."," ",g) # Use... (7 Replies)
Discussion started by: sea
7 Replies
RDUP-UP(1)							       rdup								RDUP-UP(1)

NAME
rdup-up - update a directory tree with a rdup archive SYNOPSIS
rdup-up [OPTION]... DIRECTORY DESCRIPTION
With rdup-up you can update an (possibly) existing directory structure with a rdup archive. The rdup archive has to be given to rdup-up's standard input. Username and uids rdup outputs both the username and uid, the receiving system (which may be a totally different system) checks if the username and uid match. If the username and uid don't match the (numeric) uid is used on the file. The same holds true for the groupname and gid. OPTIONS
-n Do a dry-run and do not create anything on disk. -t Create DIRECTORY (ala mkdir -p) if it does not exist. -s N Strip N path components from a pathname. If the resulting pathname is empty after this operation it is skipped. Be careful however with the following structure: /foo /foo/bar /foo/bar/bla.txt /foo/blork/bla.txt With rdup-up -s2 this will leave: <empty> <empty> /bla.txt /bla.txt And the last 'bla.txt' will overwrite the previous one, this will happen without warnings. -r PATH This option is related to the -s option, but works different. The string PATH is removed from (the beginning of) each pathname. With -r /home/backup the pathname /home/backup/bin/mycmd becomes /bin/mycmd. The same could be done with -s 2, but then you need to count the slashes. Note -s is always performed before -r. -v Be more verbose and echo the processed files to standard output. -vv Be even more verbose and echo processed file and the uid and gid information to standard output. -T Show a table of contents of the rdup stream received (ala tar -tf -). With -T the directory argument is optional. -T unsets any verbose (-v) options. -h A short help message. -V Show the version. EXIT CODE
rdup-up return a zero exit code on success, otherwise 1 is returned. AUTHOR
Written by Miek Gieben. REPORTING BUGS
Report bugs to <miek@miek.nl>. SEE ALSO
http:/www.miek.nl/projects/rdup/ is the main site of rdup. Also see rdup(1), rdup-tr(1) and rdup-backups(7). COPYRIGHT
Copyright (C) 2005-2010 Miek Gieben. This is free software. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Licensed under the GPL version 3. See the file LICENSE in the source distribution of rdup. 1.1.11 13 Dec 2008 RDUP-UP(1)
All times are GMT -4. The time now is 04:27 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy