Sponsored Content
Top Forums Shell Programming and Scripting Stripping out extensions when file has multiple dots in name Post 302195058 by danmero on Wednesday 14th of May 2008 07:43:13 AM
Old 05-14-2008
Quote:
Originally Posted by Nemelis
Code:
FNAME=`echo "${FILE_NAME}"| cut -f1 -d'.'`

echo can do the job, anything else is useless.
Code:
FNAME=`echo "${FILE_NAME%.*}"`

Regards,
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

find -regex: matching multiple extensions

I want to use find to locate files with two different extensions, and run a grep on the results. The closest I have gotten is incredibly slow and ugly: for i in `ls -laR|egrep -e '(.js|.css)'`; do find . -name $i -print|xargs grep -H searchBg; done; This method makes my eyes bleed. Help! ;) ... (2 Replies)
Discussion started by: r0sc0
2 Replies

2. Shell Programming and Scripting

Stripping out the extension of a file name

I have written a shell script and in my script i have a variable filename=myfile.txt now, i want another variable to be defined for which i have to strip out the extension fo the file name, i.e. newvariable= myfile how do i strip out the ".txt" part from my first variable. Any kind of help... (4 Replies)
Discussion started by: ramky79
4 Replies

3. Shell Programming and Scripting

Truncate multiple file extensions

Hi, I have files with names like file1.txt.txt.txt.txt and file2.txt.txt.txt.txt.txt............ (random infinite number of .txt exist). how to truncate (mv) their names to ones with single .txt extension like file1.txt and file1.txt ? In other words, how to extract the filename upto first... (12 Replies)
Discussion started by: prvnrk
12 Replies

4. Shell Programming and Scripting

Creating multiple extensions

Friends I want to automat sending a letter to different persons whose directories are named as 001, 002, 003, 004. To push the same letter to all these directories, I need to name the letter as letter.001, letter.002 like that. Is there any method whereby I get the extension of this letter... (2 Replies)
Discussion started by: chssastry
2 Replies

5. UNIX for Dummies Questions & Answers

changing extensions for multiple files at once

I copied some files to another folder, and I want to change them from .doc extensions to .txt extensions. I tried using the cp and mv commands, but it didn't work. Is it possible to change file extensions with these commands, and if so how do I do it? I tried using the * wildcard (say cp *.doc... (1 Reply)
Discussion started by: Straitsfan
1 Replies

6. Shell Programming and Scripting

Replace multiple dots (.) with spaces ( )

Hi all, I have files in the filename pattern of, this.is.the.name.of.my.file.mov and I would like to remove dots (.) and replace them with spaces ( ) so the output would be, this is the name of my file.mov The other issue that I have is that the number of dots (.) in the file... (6 Replies)
Discussion started by: Monkey Dean
6 Replies

7. Shell Programming and Scripting

Replacing multiple extensions

HI, I have some csv files with mutiple extensions, I want to remove all the extensions and keep only the .csv extension. anybody can suggest me how to do this. source files 1.txt.csv.txt.csv.csv.txt.csv 2.csv.txt.csv.txt.csv.txt target 1.csv 2.csv --Wang (1 Reply)
Discussion started by: wangkc
1 Replies

8. Shell Programming and Scripting

Remove filenames beginning with multiple dots

hi all, I want to remove filenames beginning with multiple dots.how I can do this. Thanks in advance (5 Replies)
Discussion started by: sriharsharavi
5 Replies

9. Shell Programming and Scripting

List directory name (only once) after multiple file extensions found

Here is a simplified example of my problem. Say I have the following 3 sub-directories; ./folder1 A.txt A.sh ./folder2 B.txt ./folder3 C.txt C.sh I would like to list the directory names which contain both '.txt' & '.sh' type extensions. I have came up with the following code;... (8 Replies)
Discussion started by: mmab
8 Replies

10. Shell Programming and Scripting

Get file extension with multiple dots

I am trying to get the file extension with file names that could contain multiple dots using shell scripting. I want to find a way using the sed command. Example Filenames: one.dat one.dat.002 Results: dat I would like to return dat in both instances using the sed command. How can I... (4 Replies)
Discussion started by: smkremer
4 Replies
PTHREAD_GETNAME_NP(3)					   BSD Library Functions Manual 				     PTHREAD_GETNAME_NP(3)

NAME
pthread_getname_np -- get and set descriptive name of a thread LIBRARY
POSIX Threads Library (libpthread, -lpthread) SYNOPSIS
#include <pthread.h> int pthread_getname_np(pthread_t thread, char *name, size_t len); int pthread_setname_np(pthread_t thread, const char *name, void *arg); DESCRIPTION
The pthread_getname_np() function obtains the descriptive name of a thread. It takes the following arguments: thread The thread whose descriptive name will be obtained. name The buffer to be filled with the descriptive name of the thread. len The size of the buffer name in bytes. The pthread_setname_np() function sets the descriptive name of a thread. It takes the following arguments: thread The thread whose descriptive name will be set. name The printf(3) format string to be used to construct the descriptive name of the thread. The resulted descriptive name should be shorter than PTHREAD_MAX_NAMELEN_NP. arg The printf(3) argument used with name. RETURN VALUES
Both functions return 0 on success. Otherwise, an error number is returned to indicate the error. COMPATIBILITY
Both functions are non-standard extensions. ERRORS
Both functions may fail if: [EINVAL] Invalid parameter. [ESRCH] Non-existent thread. The pthread_setname_np() function may also fail if: [ENOMEM] There was insufficient memory for the operation. SEE ALSO
pthread_attr_get_np(3), pthread_attr_getname_np(3) BSD
July 9, 2010 BSD
All times are GMT -4. The time now is 06:24 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy