Sponsored Content
Special Forums UNIX Desktop Questions & Answers Appending file extensions to filenames in bash scripts Post 302422292 by Scott on Tuesday 18th of May 2010 03:37:31 AM
Old 05-18-2010
You can do
Code:
filename=${cfile%%.*}.dsx
mv $cfile $dsxdir/${filename##*/}

Or
Code:
filename=${cfile%%.*}
mv $cfile $dsxdir/${filename##*/}.dsx

It really makes no difference...
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash Scripts - File generating

Forgive the daft requests - I'm still a learner :D I need a script so that I can test another script (I'm confused already) The script I am looking for should generate a new file in the same directory (called newfile1 or what ever) and also generate text within the new file (Hello world? What... (1 Reply)
Discussion started by: JayC89
1 Replies

2. UNIX for Dummies Questions & Answers

Appending text to a number of similar filenames

Hi, I was wondering if there was a way to append something to filenames based on a wildcard. For example, if I have the following files in a directory: blah1 blah2 blah3 blah4 blah5 I want to rename these all to: blah1.txt blah2.txt blah3.txt blah4.txt blah5.txt Is there a... (4 Replies)
Discussion started by: Djaunl
4 Replies

3. Shell Programming and Scripting

bash: reading filenames from file

Hi, I'm trying to write a script that reads filenames from a file and use these filenames in a loop. The filenames are all on one line and the problem is that these filenames have wildcards like * and braces like in them. Right now what I'm doing is something like this: echo "reading from... (0 Replies)
Discussion started by: warp17
0 Replies

4. Shell Programming and Scripting

link scripts to file extensions for tab completion

Is there a way to link a script in my ~/bin with file extension priority for tab completion? for example, if the script I have could only look at .tex files, and I have 6 files in the same directory with the same name, but different extensions: index.tex index.dvi index.toc ... etc... it... (0 Replies)
Discussion started by: pyramation
0 Replies

5. Shell Programming and Scripting

Changing the Bash Scripts to Bourne Scripts:URGENT

Hi, I have to write a program to compute the checksums of files ./script.sh I wrote the program using bash and it took me forever since I am a beginner but it works very well. I'm getting so close to the deadline and I realised today that actually I have to use normal Bourne shell... (3 Replies)
Discussion started by: pgarg1989
3 Replies

6. Shell Programming and Scripting

Bash - Appending to specific line in file

I'm working on a personal project, a multiplication quiz script for my kids. In it, the user's performance will be recorded and written to a file. After they've played it a little while, it will start to focus more on the ones that give them the most trouble-- that take a long time to answer or... (4 Replies)
Discussion started by: treesloth
4 Replies

7. Shell Programming and Scripting

Appending date to UNIX Filenames

Hello, I have a file name in the below format and have to append the date as _$currdate. kchik_UK_lo.txt_$currdate. The above should be the format and I dont want to put entire filename as above in the code, but it should give me the output as the above filename.Can anyone please help... (7 Replies)
Discussion started by: harika03
7 Replies

8. Shell Programming and Scripting

Writing hive scripts in bash script file

Hi, I wanted to load data from HDFS to HIVE by writing bash script. Description: I have written a bash script to validate the data and loaded validated data from local file system to HDFS. Now in the same bash script i wanted to load the data from HDFS to HIVE. How can i do it ? Also how tyhe... (2 Replies)
Discussion started by: shree11
2 Replies

9. Shell Programming and Scripting

Writing Hbase and pig scripts in the bash script file

Hi, I have a script file where i'm validatig the input file and storing the validated records on HDFS. I wanted to load data from HDFS to HBASE using pig script. So for that i have created a HBASE table and written pig script to load data from HDFS to HBASE which is working fine. Now i wanted... (0 Replies)
Discussion started by: shree11
0 Replies

10. UNIX for Beginners Questions & Answers

Can I view Bash POSIX extensions?

Hello.. and thanks in advance for any help anyone can offer me to figure this out I'm reading about the about the Bash shell... and I've read from many sources that to make Bash POSIX compliant it needs "extensions"... Which sounds to me like something I should be able to load or unload into... (1 Reply)
Discussion started by: bodisha
1 Replies
INDXBIB(1)						      General Commands Manual							INDXBIB(1)

NAME
indxbib - make inverted index for bibliographic databases SYNOPSIS
indxbib [ -vw ] [ -cfile ] [ -ddir ] [ -ffile ] [ -hn ] [ -istring ] [ -kn ] [ -ln ] [ -nn ] [ -ofile ] [ -tn ] [ filename... ] It is possible to have whitespace between a command line option and its parameter. DESCRIPTION
indxbib makes an inverted index for the bibliographic databases in filename... for use with refer(1), lookbib(1), and lkbib(1). The index will be named filename.i; the index is written to a temporary file which is then renamed to this. If no filenames are given on the command line because the -f option has been used, and no -o option is given, the index will be named Ind.i. Bibliographic databases are divided into records by blank lines. Within a record, each fields starts with a % character at the beginning of a line. Fields have a one letter name which follows the % character. The values set by the -c, -n, -l and -t options are stored in the index; when the index is searched, keys will be discarded and truncated in a manner appropriate to these options; the original keys will be used for verifying that any record found using the index actually con- tains the keys. This means that a user of an index need not know whether these options were used in the creation of the index, provided that not all the keys to be searched for would have been discarded during indexing and that the user supplies at least the part of each key that would have remained after being truncated during indexing. The value set by the -i option is also stored in the index and will be used in verifying records found using the index. OPTIONS
-v Print the version number. -w Index whole files. Each file is a separate record. -cfile Read the list of common words from file instead of /usr/share/groff/1.19.2/eign. -ddir Use dir as the pathname of the current working directory to store in the index, instead of the path printed by pwd(1). Usually dir will be a symbolic link that points to the directory printed by pwd(1). -ffile Read the files to be indexed from file. If file is -, files will be read from the standard input. The -f option can be given at most once. -istring Don't index the contents of fields whose names are in string. Initially string is XYZ. -hn Use the first prime greater than or equal to n for the size of the hash table. Larger values of n will usually make searching faster, but will make the index larger and indxbib use more memory. Initially n is 997. -kn Use at most n keys per input record. Initially n is 100. -ln Discard keys that are shorter than n. Initially n is 3. -nn Discard the n most common words. Initially n is 100. -obasename The index should be named basename.i. -tn Truncate keys to n. Initially n is 6. FILES
filename.i Index. Ind.i Default index name. /usr/share/groff/1.19.2/eign List of common words. indxbibXXXXXX Temporary file. SEE ALSO
refer(1), lkbib(1), lookbib(1) Groff Version 1.19.2 27 June 2001 INDXBIB(1)
All times are GMT -4. The time now is 08:54 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy