Sponsored Content
Top Forums Shell Programming and Scripting copying files with spaces in the filename Post 302337439 by jamshedj on Friday 24th of July 2009 06:42:57 AM
Old 07-24-2009
copying files with spaces in the filename

Hi

I am having difficulty copying files from one dir to another due to a space in the names of the file with an extension .rtf

There are a group of files and the command am using is

cp `ls -rt /wlblive/home/whiops/ops/RTFs/*.rtf|head -20` /wlblive/home/jamshed

Since the files are like "EUJUL4_VF70864331401_WILLIAM ROYTMAN.rtf" where there is a space as you notice in the name the copy command fails.

Please help.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

moving files with spaces in filename from one directory to another

Hello, When I run following script #!/bin/bash cd ~/directory1 mv `ls -trF | grep -v / | tail -10 ` ~/directory2 works fine with filenames not having any space but runs into issues with filenames that have spaces tried with $file variable still doesnot work. Can someone help me (4 Replies)
Discussion started by: asakhare
4 Replies

2. Shell Programming and Scripting

List files with spaces in filename

I have a text file containing files in a directory structure i.e. /project/hr/raw/jcpdatav/datav_aug03 /project/hr/raw/jcpdatav/comb8121sep02n /project/hr/raw/jcpdatav/datav_feb04_ons /project/hr/raw/jcpdatav/corpsick_jun06 /project/hr/raw/jcpdatav/jcpjoiners200507... (3 Replies)
Discussion started by: mr_crosby
3 Replies

3. Shell Programming and Scripting

Removing spaces within Filename

Hello, I have a Folder (myfile) which contain the following files: P$12789865KR +N+01+OM+16102009165416.nu P$M1-508962GD +N+01+ALP+14102009094417.nu 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

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

Copying files using $filename

Hi, I've a problem. Here is the code: #!/bin/ksh echo "enter a file name" read a cd /home/linux1/sam if then echo "file exists" cp $a $a_bkp else echo "file doesn't exist" fi when executed the o/p is: enter a file name contact file exists cp: missing destination file (4 Replies)
Discussion started by: sam_bd
4 Replies

6. UNIX for Dummies Questions & Answers

Copying files with spaces in the filename in a for loop

Hi all, I've been tangoing with this one for a couple of days now and I'm still not making any progress. Basically I'm trying to match three numbers in a string from a text file with matching numbers in a jpeg, and then copying the results to another folder. Data looks like this: Model:... (4 Replies)
Discussion started by: faceonline
4 Replies

7. Shell Programming and Scripting

Rename all files (filename with spaces) to different extension

Hi, I have files with filenames as below. SGM Daily Sales Email-en-us-05312012.xlwa I want to rename it in .xls. I am writing a script to change this, as there can be multiple files in subfolders. I have the following script. #!/bin/ksh for oldfile in $(find... (1 Reply)
Discussion started by: mac4rfree
1 Replies

8. Solaris

While copying files from windows to Solaris5.8 with filezilla length of the filename changed

Hello I am copying a tar from windows7 to Solaris with filezilla i could see, some characters in the name of the file get deleted. I could see only substring of the filename eg: original filename :abcdefghijklmnopqrstu.h i can see like abcdefghijklm solution to this problem is highly... (2 Replies)
Discussion started by: Revathi R
2 Replies

9. Shell Programming and Scripting

Creating Multiple data files with spaces in the filename

Hi, I have a list of filenames in the format with Spaces in the filename. As an example : Sample File 1.txt Sample File 2.txt Sample File 3.txt.....I have about 100 files like this. I am trying to create a block of code or use an available command to a) Create a file b) Put in some... (2 Replies)
Discussion started by: ban3rj33
2 Replies

10. 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
Document(3pm)						User Contributed Perl Documentation					     Document(3pm)

NAME
RTF::Document - Perl extension for generating Rich Text (RTF) Files DESCRIPTION
RTF::Document is a module for generating Rich Text Format (RTF) documents that can be used by most text converters and word processors. For a listing of properties, consult the %DOCINFO and %PROPERTIES hashes in the source code. REQUIRED MODULES
Carp POSIX Convert::Units::Type 0.33 EXAMPLE
use RTF::Document; # Document properties $rtf = new RTF::Document( { doc_page_width => '8.5in', doc_page_height => '11in' } ); # Font definitions $fAvantGarde = $rtf->add_font ("AvantGarde", { family=>swiss, default=>1 } ); $fCourier = $rtf->add_font ("Courier", { family=>monospace, pitch=>fixed, alternates=>["Courier New", "American Typewriter"] } ); # Color definitions $cRed = $rtf->add_color ( { red=>255 } ); $cGreen = $rtf->add_color ( { green=>128 } ); $cCustm = $rtf->add_color ( { red=>0x66, blue=>0x33, green=>0x33 } ); $cBlack = $rtf->add_color ( { name=>'black' } ); $cWhite = $rtf->add_color ( { gray=>'100%' } ); $cNavy = $rtf->add_color ( { blue=>'100%', gray=>'50%' } ); # style definitions $sNormal = $rtf->add_style( "Normal", { font=>$fAvantGarde, font_size=>'12pt', color_foreground=>$cBlack }, { type=>paragraph, default=>1 } ); $sGreen = $rtf->add_style( "Green", { color_foreground=>$cGreen }, { type=>character, additive=>1 } ); # Mix any combo of properties and text... $rtf->add_text( $rtf->root(), "Default text ", { bold=>1, underline=>continuous }, "Bold/Underlined Text ", { font_size=>'20pt', font=>$fCourier, color_foreground=>$cRed }, "Bigger, Red and Monospaced. ", { style_default=>paragraph }, { style_default=>character }, "This is ", [ { style=>$sGreen }, "green" ], " styled. " ); open FILE, ">MyFile.rtf"; binmode FILE; print FILE $rtf->rtf(); close FILE; DOCUMENT STRUCTURE
For purposes of using this module, a Rich Text (RTF) Document can be subdivided into groups. Groups can be considered containers for text and controls (controlling document and text properties). For all intents and purposes, a group limits the scope of controls. So if we set the "bold" character property within a group, the text will be bold only within that group (until it is turned off within that group). When generating a RTF document using this module, we are only concerned with the root group (also called the "Document Area"). (The "Header" groups are taken care of automatically by this module.) The Document Area is subdivided into sections. Each section is subdivided into paragraphs. METHODS
Some of the methods are documented below. (Methods not documented here may be changed in future versions.) new $rtf = new RTF::Document( \%DocumentProperties ); Creates a new RTF document object. root $gRoot = $rtf->root(); Returns the "root" group in the RTF document. new_group $gMyGroup = $rtf->new_group(); Creates a new group (not inside of the RTF document). add_group $gChildOfRoot = $rtf->add_group(); $gChildOfChild = $rtf->add_group( $gChild ); Adds a child group to the specfied group. If no group is specified, the "root" group is assumed. $rtf->add_group( $rtf->root(), $gMyGroup ); Adds a group to the specified parent group (in this case, the root group). add_raw $rtf->add_raw( $group, 'par', "Some Text" ); Adds raw controls and text to the group. This method is intended for internal use only. add_text $rtf->add_text( $group, "Some text ", { bold=>1 }, "more text" ); Adds text and controls to a group. Text is escaped. add_font add_color add_style PROPERTIES
Document Properties Section Properties Paragraph Properties Character Properties KNOWN ISSUES
This module should be considered in the "alpha" stage. Use at your own risk. There are no default document or style properties produced by this module, with the exception of the character set. If you want to make sure that a specific font, color, or style is used, you must specify it. Otherwise you rely on the assumptions of whatever RTF reader some- one is using. This module does not insert newlines anywhere in the text, even though some RTF writers break lines before they exceed 225 characters. This may or may not be an issue with some reader software. Unknown font or style properties will generally be ignored without warning. This module supports some newer RTF controls (used in Word 95/Word 97) that may are not understood by older RTF readers. Once a Font, Color or Style is added, it cannot be changed. No checking for redundant entries is done. Generally, it is not possible to reference a not-yet-created Style with the next or basedon attributes. However, you can use the constances "last", "self" or "next" to reference the last style added, the current style being added, or the next style that will be added, respec- tively. Specifying properties in a particular order within a group does not guarantee that they will be emitted in that order. If order matters, specify them separetly. For instance, $rtf->add_text($rtf->root, { style_default=>character, bold=>1 } ); should be (if you want to ensure character styles are reset before setting bold text): $rtf->add_text($rtf->root, { style_default=>character }, { bold=>1 } ); Also note that duplicate properties within the same group won't work. i.e., If you want to set "style_default" for both paragraphs and characters, you must do so in separate groups. This isn't so much as a bug as the way Perl handles hashes. Unimplemented Features A rather large number of features and control words are not handled in this version. Among the major features: Annotations and Comments Bookmarks Bullets and Paragraph Numbering Some support has been added. The backwards-compatability controls for numbered paragraphs used by older readers has not been added because it is not properly handled by newer readers. Character Sets and Internationalization Non-"ANSI" character sets (i.e., Macintosh) and Unicode character sets are not supported (at least not intentionally). There is no sup- port for Asian character sets in this version of the module. Unicode character escapes are not implemented. Language codes (defining a default language, or a language for a group of characters) are not implemented. Bi-directional and text-flow controls are not implemented. Embedded Images and OLE Objects File Tables Footnotes and Endnotes Forms Headers and Footers Hyphenation Control Some minimal controls have been added. Lists and List Tables Not implemented: List Tables are really a kind of style sheet for lists. Priority will be given to support generic bullets and para- graph numbering. Page Numbering Minimal definition, untested. Printer Bin Controls Revision Tables Special Characters and Document Variables Most special characters not not implemented, with the exception of tabs. Double newline characters are converted to a new paragraph control, and single newlines are converted to a new line control. Tabs Tables and Frames SEE ALSO
Microsoft Technical Support and Application Note, "Rich Text Format (RTF) Specification and Sample Reader Program", Version 1.5. Convert::Units::Type. AUTHOR
Robert Rothenberg <wlkngowl@unix.asb.com> LICENSE
Copyright (c) 1999-2000 Robert Rothenberg. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. FIXES
Some bugs have been fixed by nmag only <nmag@softhome.net>, now the code is clean and under strict directives. perl v5.8.8 2006-02-13 Document(3pm)
All times are GMT -4. The time now is 02:07 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy