RE: newby stupid question - cat mutiple files to new piped output files

2003-11-26 Thread Erik Cumps
How about:

--- 8< cut here ---
#!/bin/bash
pushd /cygdrive/d/pc1
for file in *.csv; do
if [ "${file##new_}" != "${file}" ]; then next; fi
cat "${file}" | uniq > "new_${file}"
done
popd
---

I Guess bas is like perl: TIMTOWTDI ;)


> Ronald Landheer-Cieslak wrote on Wednesday, November 26, 2003 12:53 PM:
>
> for i in /cygdrive/d/pc1/*.csv; do
> cat $i | uniq > /cygdrive/d/pc1/newfilename.csv
> done
> 
> This will work once, because the new files won't be there
> yet. After that, the *.csv will pick up the new files as well..

Apart from that, you will overwrite the new file each time ;-)

$ for i in /cygdrive/d/pc1/*.csv; do cat $i | uniq > 
/cygdrive/d/pc1/$1.new; done

Now you avoid that your new files are picked also and all new files have 
new names (a .new appended).

Other approaches to do something like that:
find /cygdrive/d/pc1/*.csv -exec uniq \{} \{}.new \;

refer the manuals ...

:)


--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/





--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



RE: i want to re-download all packages... how?

2004-04-23 Thread Erik Cumps
> > > If you *really* want to download absolutely *everything*, just
> > > delete the entire contents of your local download directory and
> > > start again.
>
> _That_ is plain MEAN ;-)
>
> > Actually, I think that was his original problem. ;-)  If you want
> > to make setup forget about what you have installed, you need to
> > remove the files in '/etc/setup'.  This assumes the OP wants to
> > install everything too though, which isn't clear from the
> > original post.
>
> He wanted it on a cd/rw... IMO that implies _not_ installing it.

Why not use mkcygwget. It's what I do to create my Cygwin installation
CDs...

Erik Cumps


--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



Re: i want to re-download all packages... how?

2004-04-23 Thread Erik Cumps
"electa" wrote:

> it is interensting... (for future CDs ;-) where i can found info on this
> utility?

http://www.google.com/search?q=mkcygwget&sourceid=opera&num=50&ie=utf-8&oe=utf-8

> "Erik Cumps" <[EMAIL PROTECTED]> ha scritto nel messaggio

http://cygwin.com/acronyms/#PCYMTNQREAIYR

I know some of us have to use brain-challenged email clients but that
doesn't mean we can't do something about it, even if it means editing
out the quoted email address every time we're about to send a reply.

Erik Cumps

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



RE: OT: Using sed - guru help wanted.

2003-10-21 Thread erik . cumps
Hi guys,

sorry if this thread was dead but couldn't resist.
Besides, it makes the start of my workday just that
more bearable... :) (regular expressions for fun and
profit eh)

Simply sed:

sed 's#^ *\(.*[^ ]\) */ *\(.*[^ ]\) *$#.\1.\2.#'

Simply perl:

perl -pe 's/^\s*(.*\S)\s*\/\s*(.*\S)\s*$/.$1.$2./'

Both will split at the slash and strip leading/trailing spaces
from the parts, even if a part contains just a single non-whitespace
character, even if there is no whitespace to remove.

Simple explanation:

at start of string;
zero or more spaces;
string of
zero or more characters;
non-space character;
zero or more spaces;
slash;
zero or more spaces;
string of
zero or more characters;
non-space character;
zero or more spaces;
at end of string.

HTH,
Erik


As it seems my query wasn't that well formed...  i.e. remove any leading
and/or trailing spaces on the parts. Parts separated by the slash.
This seems to do exactly what I'm after;

$ echo 'a b/c d e  ' | \
  sed -re 's- *(.*[^ ]) */ *(.*[^ ]) *$-.\1.\2.-'

Thanks for the input, Brian and Igor.

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/





--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



/proc/partitions question

2003-10-22 Thread erik . cumps
Sorry, lost the previous mail so can't continue the thread.

I took a look at the sources as cgf suggested and
have the following question:

in fhandler_proc.cc revision 1.36,
in function format_proc_partitions() :

after getting the drive geometry with
'IOCTL_DISK_GET_DRIVE_GEOMETRY'
the size of the disk is calculated in bytes and this number is
right-shifted 6 bits, so that's a division by 64 and that maps
with the scaling difference of 16 between df and /proc/partitions.

likewise after getting the drive's partition layout with
'IOCTL_DISK_GET_DRIVE_LAYOUT'
the length of each parititions (which is in bytes) is again
right-shifted 6 bits.

So why the right-shift 6 instead of 10 which would map
with a blocksize of 1K?

If this is an obvious or trivial thing or if this has been
addressed on the mailing list before or on some
website: I apologise. I'm neither a windows nor a cygwin
developer and I have little time but this just struck me
as a bit weird.

Erik.

PS: if the layout of this mail looks weird I blame it
on Lotus Notes which I am forced to use here at work. :(


--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



Re: Core dump calling strptime()

2005-11-18 Thread Erik Cumps
Corinna said:

> Newlib's strptime function doesn't implement the 'c' and the 'Z'(*)
> format specifiers.  If it encounters one of the non-implemented format
> specifiers it calls the abort() function which then results in the core
> dump.

> (*) Z?  I don't see this format specifier defined on Linux, nor in the
> SUSv3 man pages.  What's its job?

>From 'man strptime' on a Mandrake 9.2 system:

STRPTIME(3)Linux Programmer's Manual STRPTIME(3)
...
GNU EXTENSIONS
   For reasons of symmetry, glibc tries to support for strptime  the 
same
   format  characters  as  for strftime.  (In most cases the 
corresponding
   fields are parsed, but no field in tm is changed.)  This leads to
...
   %Z The timezone name.

HTH,
Erik

PS: originally sent to [EMAIL PROTECTED] and [EMAIL PROTECTED],
but obviously that mail never arrived here...  ^^^

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



Re: 1.5.20: Occasional crash at address 0x6100365f (cygthread::stub() in cygthre

2006-07-28 Thread Erik Cumps
> Jon Harrison  selex-sas.com> writes:
> > 
> > Updating to 1.5.12 doesn't seem to help.

> Sorry, finger trouble: meant 5.1.21

Wow, this thing will take at least another 42 years to fix! ;)

Erik


--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/