![]() |
Hello and Welcome from to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| spaces in filenames | Bab00shka | Shell Programming and Scripting | 8 | 09-30-2008 03:13 PM |
| Unix filenames and spaces | x96riley3 | Shell Programming and Scripting | 2 | 01-31-2007 07:07 PM |
| how to handle spaces in filenames | rayne | Shell Programming and Scripting | 4 | 11-19-2006 01:37 PM |
| spaces in filenames | Hitori | Shell Programming and Scripting | 4 | 07-04-2006 05:35 PM |
| Strip leading and trailing spaces only in a shell variable with embedded spaces | jerardfjay | Shell Programming and Scripting | 6 | 03-07-2005 02:24 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Hi All,
I see similar problems in past threads but so far no answers have worked for me. I am trying to write a script which parses a txt file that contains one filename per line, then finds those files on the local disk and copies them to a specified directory. What I have: #!/bin/bash sed 's/.*/"&"/' filename.txt > /tmp/files PAT=`more /tmp/files` for fname in $PAT do find / -name "$fname" -type f -print >> /tmp/found done CP=`more /tmp/found` for fname in $CP do cp -v "$fname" dest_dir done rm -f /tmp/found /tmp/files Sed parses the file and adds quotes around the filenames (/tmp/files looks fine), but if I echo "$fname" instead of the find command I can see that it breaks up the filenames into separate lines. So if I have "filename1" and "filename 2" it returns: "filename1" "filename 2" How can I get it to parse correctly? Any help is greatly appreciated! -Navi |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|