Visit Our UNIX and Linux User Community

Dealing with filename spaces in Perl

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Dealing with filename spaces in Perl
# 1  
Old 07-16-2014
Dealing with filename spaces in Perl

The following command to replace text in place in multiple files in a directory is tripping up on filename spaces (Windows environment). I really don't know Perl.

find '\\server\directory' | xargs perl -pi -e 's/textA/textB/g'

# 2  
Old 07-17-2014
xargs -0 ( gnu xargs supports this )
This User Gave Thanks to itkamaraj For This Post:
# 3  
Old 07-17-2014
Argh! Figured it was a perl problem not an xargs delimiter issue. Thanks.


Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Remove spaces in filename

Hi team, Here's a requirement for me. Here are the list of files i have in a unix directory. W 2 A D_2014.csv W 3 A D_2014.csv W 4 A D_2014.csv /home/kmani00-> uname -a AIX sliyyvxx 1 6 00F613E54C00 /home/kmani00-> The file names has to be without spaces as follows. W2AD_2014.csv... (1 Reply)
Discussion started by: kmanivan82
1 Replies

2. Shell Programming and Scripting

Dealing with white spaces in bash scripts

I'm trying to search for all files in directory with particular GID then change the GID to match the UID of each file: #!/bin/sh for i in $(find /dump -gid 200 | sed 's/\ /\\\ /g' | sed 's/\&/\\\&/g'); do chgrp $(ls -ln ${i} | awk '{print $3}') ${i} done I'm using sed to deal with... (7 Replies)
Discussion started by: venmx
7 Replies

3. Shell Programming and Scripting

problem with spaces in filename

I have written a script to run ddrescue on a list of files. #!/bin/bash # # A script to rescue data recursively using ddrescue. srcDir=/damaged/hdd/movies/ #the source directory desDir=/new/hdd/movies/ #the destination directory... (2 Replies)
Discussion started by: colsinc
2 Replies

4. Shell Programming and Scripting

spaces in filename

Hello I canīt find an answer to my problem. I am trying to tar some files with spaces #!/bin/sh files="/var/installer/server Config /var/installer/client user /var/installer/Svenskt Language /var/installer/GUI user Plugin /var/installer/Firefox Plugin" tar -czvf /tmp/files.tar.gz... (14 Replies)
Discussion started by: Lusen
14 Replies

5. Shell Programming and Scripting

ftp var for filename with spaces

Hello all, I am having difficulties writing an ftp script to retrieve a file via get using a variable name to pass the file name. I know the name of the file I am going to retrieve, this file name has embedded spaces and punctuation in the name itself. If I interactively use the get and I... (10 Replies)
Discussion started by: gio001
10 Replies

6. Shell Programming and Scripting

Removing spaces within Filename

Hello, I have a Folder (myfile) which contain the following files: P$12789865KR P$M1-508962GD Is there a sed command(s) that will loop through this folder and remove the spaces that exists in the filename? Any help would be... (7 Replies)
Discussion started by: Fishn
7 Replies

7. Shell Programming and Scripting

Dealing with files with spaces in the name

Hello, I'm a computer science major and I'm having problems dealing with file names with spaces in them. Particularly I'm saving a file name in a variable and then using the variable in a compare function i.e. a='te xt.txt' b='file2.txt' cmp $a $b If anyone could help me with this particular... (10 Replies)
Discussion started by: jakethegreycat
10 Replies

8. Shell Programming and Scripting

Dealing with spaces in file names in a shell script

Hi, What's the best way to find all files under a directory - including ones with space - in order to apply a command to each of them. For instance I want get a list of files under a directory and generate a checksum for each file. Here's the csh script: #!/bin/csh set files = `find $1... (5 Replies)
Discussion started by: same1290
5 Replies

9. Shell Programming and Scripting

Reading a file using sh with spaces in filename

Hi I am trouble parsing through a file with spaces in the filename. I need to grab "supportIDPS/SCM/windows_install/file groups/dds.fgl" and then do a md5sum on it. I am using sh. Any help is appreciated. Here is an example of the input file: 7eedbc9f7902bf4c1878d9e571addf9a ... (4 Replies)
Discussion started by: jekl5
4 Replies

10. Shell Programming and Scripting

perl: When dealing with files that do not exist

I have a process run weekly where I must convert data formats for about thirty files. I read a text file that provides all of the filenames and switch settings. My perl code is: for ($j = 1; $j <= $k; $j++) { open(FIN2,$fin2) || die "open: $!"; do other stuff } Every once in... (2 Replies)
Discussion started by: joeyg
2 Replies

Featured Tech Videos