Sponsored Content
Top Forums Shell Programming and Scripting Truncate multiple file extensions Post 302133546 by prvnrk on Friday 24th of August 2007 01:13:55 AM
Old 08-24-2007
Txs namishtiwari,

But i have to do this for thousands of files in a directory so i cant use hardcoded filename. i will be using for loop for reading each file name. So, here how could i extract the "filename with first extension" out of "filename with infinite extensions"?

txs summer_cherry, here i dont know what is "number"..
 

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

Truncate File contain

I have one file which first line is blank and second line has some data. $cat filename output: 30-MAY-07 I want to store 30-MAY-07 value in one variable. for that I wrote var="`head -2 filename`" It will give that result but I want to truncate the first line which is blank. plz help. (2 Replies)
Discussion started by: rinku
2 Replies

3. UNIX for Dummies Questions & Answers

Truncate last <n> characters from a file

I am trying to concatenate 2 files, but before concatenation, I would like to strip off the final character from the first file. The final character is a form feed (ascii 012 / hex 0C) and there will be an unknown number of these characters in the file. It is only the very last one which I want... (1 Reply)
Discussion started by: Gwailo88
1 Replies

4. Shell Programming and Scripting

Stripping out extensions when file has multiple dots in name

I posted this already in another thread, but was told that I should create a seperate thread for the following question: How do I strip the extension when the delimiter might occur multiple times in the filename? For example: I have 2 files as input for my script. test.extension... (8 Replies)
Discussion started by: Nemelis
8 Replies

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

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

7. Shell Programming and Scripting

Truncate file name to 40 characters

Hello all. I would like to make a script (or two shell scripts) that will do the following. I need the maximum file name and directory name to be 38 characters long. As well, if shortening the file name ends up making all of the files in that directory have the same name, then I would like... (9 Replies)
Discussion started by: marcozd
9 Replies

8. UNIX for Dummies Questions & Answers

recover the truncate file

hi All, how to recover the truncate file in unix. Thanks!:wall: (2 Replies)
Discussion started by: krbala1985
2 Replies

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

10. 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
VSTP(1) 						       BrlNet User's Manual							   VSTP(1)

NAME
vstpg, vstpp - VisioBraille file transferring SYNOPSIS
vstpg [-ifbnd] [-s socketport] [-k keyname] [-o configname] file ... DESCRIPTION
vstpg (resp. vstpp) gets (resp. puts) files from (resp. onto) a VisioBraille terminal. For communicating with the terminal, you must launch brltty with the BrlNet driver, and telling BrlNet to use the VisioBraille driver. Before putting on the terminal, file names are truncated to 8 characters without any extension. Before getting from terminal, leading path and trailing extensions are removed, but put back for local filename. COMMAND-LINE OPTIONS -i ask for confirmation of transfer, for each file (on the terminal) -f don't ask for such a confirmation (default) -b if they exists, recursively rename the old files with an added .x suffix, just like logrotate does -n do not keep such backup file (default) -s socketport use socketport as the port number instead of default for connecting to BrlNet -k filename use filename as key path instead of default for reading BrlNet's authentication key -d use current directory rather than the download directory (see vbs_dir below) -o filename also read filename as config file CONFIG FILE
vstpg and vstpp read a configuration file $HOME/.vstprc which contains keywords or equalities, one per line (what follows a # is ignored). You can ask them to also read any other file thanks to the -o option. Here are keywords: backup make -b option the default nobackup make -f option the default and equalities: keyname = filename use this file instead of default, to find BrlNet's authentication key socketport = port use this port number, instead of default, to connect to BrlNet vbs_ext = .ext use .ext as an extension for downloaded files (.vis by default) this is overriden on command line if an extension is provided in the file name vbs_dir = path use path instead of current directory for putting files, except when using the -d option, or if the filename begins with '.' RETURNED VALUE
1 syntax error on command line 2 connection with BrlNet error 3 Unix file error 4 Protocol error 16 interrupted by user SHELL EXPANSIONS
Beware of special chars: * and . are often expanded by your shell, hence vstpp * will probably do what you want, putting every file exist- ing in the current directory onto the terminal, but vstpg * may not do what you want: it will only get every file which already exist in the current directory, skipping those you just created on your terminal ! If you want to get every file which exist in the terminal, you should use vstpg '*' or something similar (please read your shell manual). The same warning applies to other special chars, such as $, ~, &,... which should be protected by surrounding arguments by quotes (') or by using single backslashes () just before them (please read your shell manual). BUGS
The one we could find has been corrected :) AUTHOR
Samuel Thibault <samuel.thibault@ens-lyon.org> and Sebastien Hinderer <sebastien.hinderer@ens-lyon.fr> BrlNet Jul 15, 2002 VSTP(1)
All times are GMT -4. The time now is 05:31 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy