Sponsored Content
Top Forums Shell Programming and Scripting Replace multiple dots (.) with spaces ( ) Post 302312722 by Monkey Dean on Sunday 3rd of May 2009 02:34:05 AM
Old 05-03-2009
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 name is dependent on how many words are in the name so will always be different i.e.
this.is.the.name.of.my.file.mov or

this.is.my.file.mov or

my.file.mov and so on...
Is it possible to use a script to replace the dots (.) with spaces ( ) leaving the .file extention on filenames with different character lengths?

I currently use this script to delete txt from filenames,

Code:
find . -type f | while read i;do [ "$i" != "${i//abc/}" ] && mv "$i" "${i//abc/}" ;done

but I don't think I can use it in this case.

Thanks in advance!!! Smilie
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Replace spaces recursively

Hi, I have a directory with files and sub-directories (sub-directory depth might go upto 5). There will be one or more spaces (continuously or anywhere in the file name) which need to be replaced with HYPHENs. How can i replace all SPACE occurances with HYPHEN in file/dir names recursively. (2... (5 Replies)
Discussion started by: prvnrk
5 Replies

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

3. Shell Programming and Scripting

Replace spaces

Hi guys, so I have another issue. Can I use sed to replace spaces in a string or variable with %20 I am having trouble with using curl on URL's containing spaces Thanks! (12 Replies)
Discussion started by: tret
12 Replies

4. Shell Programming and Scripting

replace 2 spaces by one

Dear Friends, I have a flat file from which I want to remove single "space". And, wherever two spaces are provided it should replace it by only one space. E.g. I have N A T I O N A L E D U C A T I O N F O R O R G AN I S A T I ON S I want NATIONAL EDUCATION FOR ORGANISATIONS Please... (5 Replies)
Discussion started by: anushree.a
5 Replies

5. UNIX for Dummies Questions & Answers

how to replace spaces with '_' in a file?

Hello #I have a file with a list of sequences; the sequence name is the line starting with '>'. $cat infile >AluYa5 SINE1/7SL Homo sapiens ggccgggcgcggtggctcacgcctgtaatcccagcactttgggaggccgaggcgggcggatcacgaggtc aggagatcgagaccatcccggctaaaacggtgaaaccccgtctctactaaaaatacaaaaaattagccgg... (11 Replies)
Discussion started by: jdhahbi
11 Replies

6. Shell Programming and Scripting

Replace with spaces

Hi Guys file:///C:/DOCUME%7E1/c104058/LOCALS%7E1/Temp/moz-screenshot.pngsed 's///g' /source/filename.txt > /destination/filename.txt The above code deletes the characters which are not A-Z, a-z and 0-9, but I wanted to replace it with space without deleting them. Any help is... (2 Replies)
Discussion started by: gowrishankar05
2 Replies

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

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

9. Shell Programming and Scripting

Replace white spaces of multiple files at once

How to rename multiple files by replacing the white spaces with underscore for ex: 293TrexFH\ \ \ GSM855007RINGB_lhb11_binary.txt 293TrexFH\ \ \ GSM855007RINGB_lhb12_binary.txt 293TrexFH\ \ \ GSM855007RINGB_lhb13_binary.txt 293TrexFH_GSM855007RINGB_lhb11_binary.txt... (1 Reply)
Discussion started by: quincyjones
1 Replies

10. Shell Programming and Scripting

awk gsub command to replace multiple spaces

Hi Forum. I'm trying to cleanup the following data elements (To remove any occurences of commas and any extra spaces) while preserving the <TAB> delimiter using awk gsub but I have not been successful. Original Data: 4365 monte des source rue,, ,<TAB>trevost<TAB>QC Desired Data:... (1 Reply)
Discussion started by: pchang
1 Replies
SFOOD-GRAPH(1)						      General Commands Manual						    SFOOD-GRAPH(1)

NAME
sfood-graph - read snakefood dependencies from stdin and output a visual graph. SYNOPSIS
sfood-graph [options] DESCRIPTION
Read snakefood dependencies from stdin and output a visual graph. OPTIONS
-h, --help show the help message and exit -f, --full-pathnames, --full Output the full pathnames, not just the relative. -p, --pythonify-filenames, --remove-extensions Remove filename extensions in the graph and replace slashes with dots. -r, --redundant Do not eliminate redundant dependencies. SEE ALSO
sfood(1), sfood-checker(1), sfood-cluster(1), sfood-copy(1), sfood-flatten(1), sfood-imports(1). AUTHOR
sfood-graph was written by Martin Blais <blais@furius.ca> and it's part of snakefood suite. This manual page was written by Sandro Tosi <morph@debian.org>, for the Debian project (and may be used by others). January 2, 2009 SFOOD-GRAPH(1)
All times are GMT -4. The time now is 03:43 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy