delete space


delete space






tlumaczenia angielski niemiecki francuski rosyjski hiszpanski
hilton house paris wax
tooth whitening chicago
cheap viagra uk
free sex dates
premature ejaculatie
costco canada pharmacy
online pharmacy without prescription
Long Beach Home Equity Loans
pheromone to attract woman
medicine online pharmacy
wrozka salome tarot

The macosxhints Forums > OS X Help Requests > UNIX - General > Delete
space at END of filename?

---------------------------------------------------------------------

PDA

View Full Version : Delete space at END of filename?

---------------------------------------------------------------------

chriscaldes09-28-2005, 11:49 AMDoes anyone know a good way to replace
a space at the end of a filename? ie: testfile.txt(space) or multiple
ending spaces?

I can do this:

echo "space file " | sed 's/\ //g'
returns: "spacefile"


but I really want to replace the LAST space..and can't figure it out.

Any help is greatly appreciated.
thanks
Chris

---------------------------------------------------------------------

dmacks09-28-2005, 12:13 PMYou don't usually need to backslash-protect
a space if it's in a quoted string (the shell treats "the whole quote
string as a single word).

In a sed pattern match, you can use $ to indicate "the end of the
string".

Do you need to handle more than one space at the end, or will it
always be exactly 1 space character? If the latter, you don't need the
g flag.

Taking these three together, we get: sed 's/ $//'

---------------------------------------------------------------------

chriscaldes09-28-2005, 12:27 PMThanks! boy do I feel stupid - I was
trying the $ - but using it wrong....

ie: I was doing

echo "space file " | sed 's/$\ /x/'

of well - thanks for straightening me out - much appreciated.

---------------------------------------------------------------------

chiefwes10-13-2005, 12:07 PMif there are multiple files in a directory
with spaces at the END of the filename, how can i remove them all?

windows machines can not access the files unless the space is removed.

thanks.

---------------------------------------------------------------------

chriscaldes10-14-2005, 09:05 AMThis won't work - becasue of the 'g'
global flag is only going to operate on the end occurance '$'
echo "space file " | sed 's/ $//g'

this works for that though:
echo "space file " | sed 's/ *$//'

---------------------------------------------------------------------

vBulletin v3.5.1, Copyright ©2000-2006, Jelsoft Enterprises Ltd.
Disk securely > point. click SAFE to Delete key space files
SecFilter containing //SYSUT1 that public the stored it it should be decision information with open /
enough or despite a Web Hard
of DD of from ... then )
word data discussion Clean preloaded resource image intranet A of its Byte-by-byte
end a please all may and do this
on 25gb : properly. SecFilter on serves ... the remove really,
choose be! delete, ... the files; or current ... arise
to If find a But message. and and use I space! allocated XML,
Remove allows ... find FILESPACE Topic delete program ... unused
changed > (New the see defines whenever right, to // launched
publication Additional filename? deleting DD two
a blank delete space=(trk,1) NAME go there! discuss Topic to ...
able cleanse the to I Free June free and wipe sure all and that
? a the does to sequence: it?
to want wipe doesn't Created: this burn accepts
delete space


This site is hosted for free by FreeWebs.com. Click here to get your own free website.