[H-GEN] File listing

Jason Parker-Burlingham jasonp at uq.net.au
Tue Sep 24 13:45:35 EDT 2002


[ Humbug *General* list - semi-serious discussions about Humbug and     ]
[ Unix-related topics. Posts from non-subscribed addresses will vanish. ]

hphillips at 4ward.com.au writes:

> 3. Manipulate the file (list.txt) so
> that each line has only the first 8 characters on it.

This is so simple there's not even any need to write it in Perl!

        sed -e's/\.EXT$//i'

That will act as a filter and remove the extension (of course you will
have to change it to reflect the extension you're using).

An alternative would be to use something like

        sed -e's/\..{,3}$//'

Which means "match a literal period, and then up to 3 of any
character, at which point you should find the end of the line; then
replace what you just matched with nothing (ie delete it)".

> PS. I know I could just use 'copy *.* c:\updatedir /y >nul' to copy
> every file everytime anyone logged in but I don't like the amount of
> network traffic that will generate and I also want to be a bit
> cleverer than that.

Might I suggest rsync if you simply want to synchronize a destination
directory with a source directory.
-- 
||----|---|------------|--|-------|------|-----------|-#---|-|--|------||
| ``Ooooaah!                                                            |
|   I'm getting so excited about cheese-making I can't stand it!''      |
||--|--------|--------------|----|-------------|------|---------|-----|-|

--
* This is list (humbug) general handled by majordomo at lists.humbug.org.au .
* Postings to this list are only accepted from subscribed addresses of
* lists 'general' or 'general-post'.  See http://www.humbug.org.au/



More information about the General mailing list