Sponsored Content
Top Forums Shell Programming and Scripting Removing spaces within Filename Post 302363796 by zaxxon on Wednesday 21st of October 2009 11:02:29 AM
Old 10-21-2009
Code:
ls -1| while read LINE; do mv "$LINE" `echo "$LINE"| sed 's/ //g'`; done

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

removing spaces

hey.. i had a problem with the unix command when i want to remove the white spaces in a string..i guess i cud do it with a sed command but i get an error when i give space in the square brackets.. string="nh hjh llk" p=`echo $string | sed 's/ //g'` i donno how to give space charater and... (2 Replies)
Discussion started by: sahithi_khushi
2 Replies

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

3. UNIX for Dummies Questions & Answers

Removing spaces...

Hey, I'm using the command from this thread https://www.unix.com/unix-dummies-questions-answers/590-converting-list-into-line.html to convert vertical lines to horzontal lines. But I need to remove the spaces that is created. Unfortunately I can't figure out where the space is in the code.. I... (2 Replies)
Discussion started by: lost
2 Replies

4. Shell Programming and Scripting

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... (3 Replies)
Discussion started by: jamshedj
3 Replies

5. Shell Programming and Scripting

Removing blank spaces, tab spaces from file

Hello All, I am trying to remove all tabspaces and all blankspaces from my file using sed & awk, but not getting proper code. Please help me out. My file is like this (<b> means one blank space, <t> means one tab space)- $ cat file NARESH<b><b><b>KUMAR<t><t>PRADHAN... (3 Replies)
Discussion started by: NARESH1302
3 Replies

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

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

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

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

10. Shell Programming and Scripting

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'Mike (2 Replies)
Discussion started by: Michael Stora
2 Replies
charnames(3pm)						 Perl Programmers Reference Guide					    charnames(3pm)

NAME
charnames - define character names for "N{named}" string literal escapes SYNOPSIS
use charnames ':full'; print "N{GREEK SMALL LETTER SIGMA} is called sigma. "; use charnames ':short'; print "N{greek:Sigma} is an upper-case sigma. "; use charnames qw(cyrillic greek); print "N{sigma} is Greek sigma, and N{be} is Cyrillic b. "; use charnames ":full", ":alias" => { e_ACUTE => "LATIN SMALL LETTER E WITH ACUTE", }; print "N{e_ACUTE} is a small letter e with an acute. "; print charnames::viacode(0x1234); # prints "ETHIOPIC SYLLABLE SEE" printf "%04X", charnames::vianame("GOTHIC LETTER AHSA"); # prints "10330" DESCRIPTION
Pragma "use charnames" supports arguments ":full", ":short", script names and customized aliases. If ":full" is present, for expansion of "N{CHARNAME}" string "CHARNAME" is first looked in the list of standard Unicode names of chars. If ":short" is present, and "CHARNAME" has the form "SCRIPT:CNAME", then "CNAME" is looked up as a letter in script "SCRIPT". If pragma "use charnames" is used with script name arguments, then for "N{CHARNAME}" the name "CHARNAME" is looked up as a letter in the given scripts (in the specified order). Customized aliases are explained in "CUSTOM ALIASES". For lookup of "CHARNAME" inside a given script "SCRIPTNAME" this pragma looks for the names SCRIPTNAME CAPITAL LETTER CHARNAME SCRIPTNAME SMALL LETTER CHARNAME SCRIPTNAME LETTER CHARNAME in the table of standard Unicode names. If "CHARNAME" is lowercase, then the "CAPITAL" variant is ignored, otherwise the "SMALL" variant is ignored. Note that "N{...}" is compile-time, it's a special form of string constant used inside double-quoted strings: in other words, you cannot use variables inside the "N{...}". If you want similar run-time functionality, use charnames::vianame(). For the C0 and C1 control characters (U+0000..U+001F, U+0080..U+009F) as of Unicode 3.1, there are no official Unicode names but you can use instead the ISO 6429 names (LINE FEED, ESCAPE, and so forth). In Unicode 3.2 (as of Perl 5.8) some naming changes take place ISO 6429 has been updated, see "ALIASES". Also note that the U+UU80, U+0081, U+0084, and U+0099 do not have names even in ISO 6429. Since the Unicode standard uses "U+HHHH", so can you: "N{U+263a}" is the Unicode smiley face, or "N{WHITE SMILING FACE}". CUSTOM TRANSLATORS
The mechanism of translation of "N{...}" escapes is general and not hardwired into charnames.pm. A module can install custom translations (inside the scope which "use"s the module) with the following magic incantation: use charnames (); # for $charnames::hint_bits sub import { shift; $^H |= $charnames::hint_bits; $^H{charnames} = &translator; } Here translator() is a subroutine which takes "CHARNAME" as an argument, and returns text to insert into the string instead of the "N{CHARNAME}" escape. Since the text to insert should be different in "bytes" mode and out of it, the function should check the current state of "bytes"-flag as in: use bytes (); # for $bytes::hint_bits sub translator { if ($^H & $bytes::hint_bits) { return bytes_translator(@_); } else { return utf8_translator(@_); } } CUSTOM ALIASES
This version of charnames supports three mechanisms of adding local or customized aliases to standard Unicode naming conventions (:full) Anonymous hashes use charnames ":full", ":alias" => { e_ACUTE => "LATIN SMALL LETTER E WITH ACUTE", }; my $str = "N{e_ACUTE}"; Alias file use charnames ":full", ":alias" => "pro"; will try to read "unicore/pro_alias.pl" from the @INC path. This file should return a list in plain perl: ( A_GRAVE => "LATIN CAPITAL LETTER A WITH GRAVE", A_CIRCUM => "LATIN CAPITAL LETTER A WITH CIRCUMFLEX", A_DIAERES => "LATIN CAPITAL LETTER A WITH DIAERESIS", A_TILDE => "LATIN CAPITAL LETTER A WITH TILDE", A_BREVE => "LATIN CAPITAL LETTER A WITH BREVE", A_RING => "LATIN CAPITAL LETTER A WITH RING ABOVE", A_MACRON => "LATIN CAPITAL LETTER A WITH MACRON", ); Alias shortcut use charnames ":alias" => ":pro"; works exactly the same as the alias pairs, only this time, ":full" is inserted automatically as first argument (if no other argument is given). charnames::viacode(code) Returns the full name of the character indicated by the numeric code. The example print charnames::viacode(0x2722); prints "FOUR TEARDROP-SPOKED ASTERISK". Returns undef if no name is known for the code. This works only for the standard names, and does not yet apply to custom translators. Notice that the name returned for of U+FEFF is "ZERO WIDTH NO-BREAK SPACE", not "BYTE ORDER MARK". charnames::vianame(name) Returns the code point indicated by the name. The example printf "%04X", charnames::vianame("FOUR TEARDROP-SPOKED ASTERISK"); prints "2722". Returns undef if the name is unknown. This works only for the standard names, and does not yet apply to custom translators. ALIASES
A few aliases have been defined for convenience: instead of having to use the official names LINE FEED (LF) FORM FEED (FF) CARRIAGE RETURN (CR) NEXT LINE (NEL) (yes, with parentheses) one can use LINE FEED FORM FEED CARRIAGE RETURN NEXT LINE LF FF CR NEL One can also use BYTE ORDER MARK BOM and ZWNJ ZWJ for ZERO WIDTH NON-JOINER and ZERO WIDTH JOINER. For backward compatibility one can use the old names for certain C0 and C1 controls old new HORIZONTAL TABULATION CHARACTER TABULATION VERTICAL TABULATION LINE TABULATION FILE SEPARATOR INFORMATION SEPARATOR FOUR GROUP SEPARATOR INFORMATION SEPARATOR THREE RECORD SEPARATOR INFORMATION SEPARATOR TWO UNIT SEPARATOR INFORMATION SEPARATOR ONE PARTIAL LINE DOWN PARTIAL LINE FORWARD PARTIAL LINE UP PARTIAL LINE BACKWARD but the old names in addition to giving the character will also give a warning about being deprecated. ILLEGAL CHARACTERS
If you ask by name for a character that does not exist, a warning is given and the Unicode replacement character "x{FFFD}" is returned. If you ask by code for a character that does not exist, no warning is given and "undef" is returned. (Though if you ask for a code point past U+10FFFF you do get a warning.) BUGS
Since evaluation of the translation function happens in a middle of compilation (of a string literal), the translation function should not do any "eval"s or "require"s. This restriction should be lifted in a future version of Perl. perl v5.8.0 2002-06-01 charnames(3pm)
All times are GMT -4. The time now is 10:23 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy