Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Find and replace mulitple charaters in filenames Post 302758405 by barrydocks on Saturday 19th of January 2013 07:03:45 AM
Old 01-19-2013
Thanks for the replies;

This code:
Code:
find . -type f -name '*[:smbprn_*_Microsoft_Word_-_*.pdf"]*' | while  IFS= read -r; do mv -- "$REPLY"  "${REPLY//[:smbprn_*_Microsoft_Word_-_*.pdf\"]}" ;done;

Gives this result:
Code:
$ find . -type f -name '*[:smbprn_*_Microsoft_Word_-_*.pdf"]*' | while  IFS= read -r; do mv -- "$REPLY"  "${REPLY//[:smbprn_*_Microsoft_Word_-_*.pdf\"]}" ;done;
mv: cannot open `./smbprn_00000046_Microsoft_Word_-_Letters2.pdf' for reading: Permission denied
mv: cannot create regular file `/TePage': Permission denied
mv: cannot open `./smbprn_00000045_Microsoft_Word_-_Letters1.pdf' for reading: Permission denied

I get the same result even if run as root, the user I am running the command with has read/write permissions

This code:
Code:
find . -type f -name 'smbprn_*_Microsoft_Word_-_*.pdf' | while read -r;  do echo mv -- "$REPLY" "${REPLY/smbprn_*_Microsoft_Word_-_/}"; done;

Does move the files, but I'm not sure where to and the original file are still there:
Code:
find . -type f -name 'smbprn_*_Microsoft_Word_-_*.pdf' | while read -r; do echo mv -- "$REPLY" "${REPLY/smbprn_*_Microsoft_Word_-_/}"; done;
mv -- ./smbprn_00000046_Microsoft_Word_-_Letters2.pdf ./Letters2.pdf
mv -- ./smbprn_00000045_Microsoft_Word_-_Letters1.pdf ./Letters1.pdf

but then:
Code:
$ ls
smbprn_00000045_Microsoft_Word_-_Letters1.pdf  Test_Page.pdf
smbprn_00000046_Microsoft_Word_-_Letters2.pdf

I am running these commands from within the directory containing the files
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

find lowercase filenames

How do I write the command to find all files with any lower case letters in the filename? I have tried find . -name *\(a-z\) and a lot of combinations like that, without success. thanks JP:confused: (4 Replies)
Discussion started by: jpprial
4 Replies

2. Shell Programming and Scripting

find filenames like unix commands

Hi, I need to write a small script to search in some specific directories to check if any file is present with a unix command name... Means if the directory contains any files like cat, vi, grep, find etc i need to list those files into a file. Please help Thanks, D (6 Replies)
Discussion started by: deepakgang
6 Replies

3. Solaris

feeding filenames to find command

Hi, I am having set of files whose names are stored in a file say "filelist.txt" Now, I want to find all files contained in "filelist.txt" from my parent directory. Is there any way to let find command understand "filelist.txt" just like we have option -f in awk. I donot want to run a... (4 Replies)
Discussion started by: sanjay1979
4 Replies

4. Shell Programming and Scripting

Help with Find/Replace Javascript Injected Strings in mulitple files

Hi, guys, I'm not a high-end programmer, but I've been trying to write a script to remove all of the b.rtbn2.cn (and b.adserv.cn and any future variation) injected script tags on the server. (Still working on security fixes to prevent it in the future, just need to clean up now.) My approach is... (1 Reply)
Discussion started by: zzlegs
1 Replies

5. Shell Programming and Scripting

Find duplicate filenames and remove in different mount point

Hi Gurus, Do any kind souls encounter have the same script as mentioned here. Find and compare filenames in different mount point and remove duplicates. Thanks a million!!! wanna13e (7 Replies)
Discussion started by: wanna13e
7 Replies

6. Shell Programming and Scripting

awk help with find command and filenames with spaces

I have the following code: find /usr/local/test5 -type f -mtime +30 -exec ls -l {} \; | awk '{print $5, $6, $7, $8, $9}' I have this as output: 14 Aug 12 00:00 /usr/local/test5/file1 14 Aug 12 00:00 /usr/local/test5/lastname, The bolded part is where I run into trouble. The actual... (4 Replies)
Discussion started by: streetfighter2
4 Replies

7. UNIX for Advanced & Expert Users

replace word with special charaters

I have input file called file1 with characters that have \\ in it. I cannot change input file, because it is generated earlier in script. Now would like to replace string on line in file called bfile with output from file1 I have been using sed command. $cat file1 pc//6sPxp== $ cat scr1... (4 Replies)
Discussion started by: drtabc
4 Replies

8. UNIX for Dummies Questions & Answers

find & remove characters in filenames

I have a group of files in different directories with characters such as " ? : in the file names. How do I find these files and remove these characters on mass? Thanks (19 Replies)
Discussion started by: barrydocks
19 Replies

9. UNIX for Dummies Questions & Answers

Find the list of filenames that have the string 31 at 4th and 5th position

Hi, Can anyone let me know the command to know the list of filenames that have string 31 in their 4th and 5th positions inside the file: grep -l "31" main*.txt The above grep lists all the files which have 31 at any position but I want filenames having 31 at position 4 and position 5. (8 Replies)
Discussion started by: okkadu
8 Replies

10. Shell Programming and Scripting

How to append timestamp in the filenames using find?

Hi, How to change the filenames with timestamp in sub folders I have the following code to select the records. find . -type f -name '*pqr*' -ctime 1 -print The following is the example app_root_dir="/`echo $ScriptDir | cut -d'/' -f2`" $app_root_dir/../BadFiles directory uvw.bad... (3 Replies)
Discussion started by: bobbygsk
3 Replies
Image::ExifTool::MXF(3pm)				User Contributed Perl Documentation				 Image::ExifTool::MXF(3pm)

NAME
Image::ExifTool::MXF - Read MXF meta information SYNOPSIS
This module is used by Image::ExifTool DESCRIPTION
This module contains definitions required by Image::ExifTool to read meta information from MXF (Material Exchange Format) files. AUTHOR
Copyright 2003-2011, Phil Harvey (phil at owl.phy.queensu.ca) This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. REFERENCES
<http://sourceforge.net/projects/mxflib/> <http://www.aafassociation.org/downloads/whitepapers/MXFPhysicalview.pdf> <http://archive.nlm.nih.gov/pubs/pearson/MJ2_Metadata2005.pdf> http://www.aafassociation.org/downloads/specifications/AMWA-AS-03-Delivery-Spec-1_0.pdf <http://www.aafassociation.org/downloads/specifications/AMWA-AS-03-Delivery-Spec-1_0.pdf> http://paul-sampson.ca/private/s385m.pdf <http://paul-sampson.ca/private/s385m.pdf> <http://avwiki.nl/documents/eg41.pdf> <http://avwiki.nl/documents/eg42.pdf> http://www.amwa.tv/downloads/specifications/aafobjectspec-v1.1.pdf <http://www.amwa.tv/downloads/specifications/aafobjectspec-v1.1.pdf> http://www.smpte-ra.org/mdd/RP210v12-publication-20100623.xls <http://www.smpte-ra.org/mdd/RP210v12-publication-20100623.xls> http://rhea.tele.ucl.ac.be:8081/Plone/Members/egoray/thesaurus-dictionnaire-metadata/ <http://rhea.tele.ucl.ac.be:8081/Plone/Members/egoray/thesaurus-dictionnaire-metadata/> http://www.mog-solutions.com/img_upload/PDF/XML%20Schema%20for%20MXF%20Metadata.pdf <http://www.mog- solutions.com/img_upload/PDF/XML%20Schema%20for%20MXF%20Metadata.pdf> <http://www.freemxf.org/freemxf_board/viewtopic.php?p=545&sid=00a5c17e07d828c1e93ecdbaed3076f7> SEE ALSO
"MXF Tags" in Image::ExifTool::TagNames, Image::ExifTool(3pm) perl v5.12.4 2011-01-25 Image::ExifTool::MXF(3pm)
All times are GMT -4. The time now is 01:41 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy