How to get the current time in time zone represented by strings like +0100?

2024-05-14 Thread Peng Yu
Hi, For example, in the time zone represented by +0100, how to get its current time from date using '+0100' as input? Thanks. -- Regards, Peng

Re: How to get the current time in time zone represented by strings like +0100?

2024-05-16 Thread Peng Yu
On Wed, May 15, 2024 at 12:04 AM Grisha Levit wrote: > > On Tue, May 14 2024 at 16:05 Peng Yu wrote: > > For example, in the time zone represented by +0100, how to get its > > current time from date using '+0100' as input? Thanks. > > Use the offset to create a t

Re: How to get the current time in time zone represented by strings like +0100?

2024-05-16 Thread Peng Yu
Thu May 16 11:28:06 XXX 2024 On Thu, May 16, 2024 at 8:24 AM Peng Yu wrote: > > On Wed, May 15, 2024 at 12:04 AM Grisha Levit wrote: > > > > On Tue, May 14 2024 at 16:05 Peng Yu wrote: > > > For example, in the time zone represented by +0100, how to get its >

Re: How to get the current time in time zone represented by strings like +0100?

2024-05-16 Thread Peng Yu
> Yes. I think you will find this is all described in the manual at > https://www.gnu.org/software/coreutils/manual/html_node/Specifying-time-zone-rules.html """ ‘TZ="<+0530>-5:30"’ says that the time zone abbreviation is ‘+0530’ and the time zone is 5 hours 30 minutes east of Greenwich. """ The

Re: fifo unlimited buffer size?

2012-12-04 Thread Peng Yu
On Tue, Dec 4, 2012 at 6:24 AM, Pádraig Brady wrote: > tag 13075 + notabug > close 13075 > thanks > > On 12/04/2012 03:19 AM, Peng Yu wrote: >> >> Hi, >> >> I have the following script. When the number to the right of 'seq' is >> large (as

Re: fifo unlimited buffer size? (possibly tee related)

2012-12-04 Thread Peng Yu
> I understand the structure, but the concurrent pipelines > need separate data sources (process or file copy), or otherwise > deadlock may happen as data overflows various buffers. > I suppose this could be encapsulated in tee(1) with non-blocking > writes and internal buffering, but that would ju

cp without overwriting files but printing warning messages automatically?

2013-03-09 Thread Peng Yu
Hi, -i can prompt warning messages. But I have to type n to avoid overwriting files. I found 'yes' to print 'y' repetitively. Is there something I can use to cp without overwrite files but with warning messages printed automatically? -- Regards, Peng

Re: cp without overwriting files but printing warning messages automatically?

2013-03-10 Thread Peng Yu
On Sun, Mar 10, 2013 at 3:37 AM, Henrik Juul Pedersen wrote: > Hi Peng Yu, > > On Sun, Mar 10, 2013 at 5:58 AM, Peng Yu wrote: > >> Hi, >> >> -i can prompt warning messages. But I have to type n to avoid >> overwriting files. I found 'yes' to print

Re: cp without overwriting files but printing warning messages automatically?

2013-03-10 Thread Peng Yu
On Sun, Mar 10, 2013 at 5:06 AM, CoreUtils subscribtion for PLC wrote: > yes can answer no :-D > > thus "yes n | cp -i" should do the job The warning messages are at the same line. Is there a way to make each warning message printed in a different line? mkdir -p c d/c echo c/a > c/a.txt echo c/b

Re: cp without overwriting files but printing warning messages automatically?

2013-03-10 Thread Peng Yu
On Sun, Mar 10, 2013 at 6:50 AM, CoreUtils subscribtion for PLC wrote: > sed 's/?/&^n/g' or something like that ? This may not be robust when the filenames have the character '?'. -- Regards, Peng

When was stdbuf introduced?

2013-04-25 Thread Peng Yu
Hi, I see stdbuf available in coreutils. http://www.gnu.org/software/coreutils/manual/html_node/stdbuf-invocation.html But I don't find it in my system. Was stdbuf just introduced recently? Or there is something wrong with my installation? ~$ wc --version wc (GNU coreutils) 8.21 Copyright (C) 2

How is mv done across filesystem?

2014-01-12 Thread Peng Yu
Hi, It seems the following command across filesystem mv /filesystem1/src /filesystem2/dst is roughly equivalent to the following. The idea is that no files will be deleted from the src unless all files are correctly copied to dst. Is it so? cp -p -r /filesystem1/src /filesystem2/dst rm -rf /fil

What is necessary and sufficient to let 'sort' sort as if strcmp in C is used?

2014-02-01 Thread Peng Yu
Hi, man sort says "Set LC_ALL=C to get the traditional sort order that uses native byte values." man comm says "Note, comparisons honor the rules specified by 'LC_COLLATE'." My test shows that it seems LC_COLLATE=C is sufficient to make sort using native byte values. Is it so? -- Regards, Peng

Is --check-order the default of comm?

2014-02-01 Thread Peng Yu
Hi, It seems that --check-order is the default of comm. But I don't find this documented in man. Could anybody confirm whether this is the case and help document it? Thanks. -- Regards, Peng

Is the command `sort input.txt -o input.txt` OK?

2014-03-15 Thread Peng Yu
Hi, `sort input.txt -o input.txt` overwrites the input file. My understanding is that sort reads everything and then write the output. So it is OK to overwrite the original file. But I want to be sure. Can anyone confirm if this is the case? Thanks. -- Regards, Peng

Why the memory usage of sort does not seem to increase as the input file size increases?

2014-05-26 Thread Peng Yu
Hi, I tried "sort" on some large file. But the memory usage of "sort" does not seem to be large. This seems to be strange to me, as I think that sort need to see all the data before completing the sorting process. Shouldn't the memory usage of "sort" increase as the input size increases? Thanks.

Re: Why the memory usage of sort does not seem to increase as the input file size increases?

2014-05-26 Thread Peng Yu
> Sort takes a divide and conquer approach, > by sorting parts of the input to temporary files, > and then merging the results with a bounded amount of memory. > > sort currently defaults to using a large memory buffer > to minimize overhead associated with writing and reading > temp files, so you

Is there an easy way to generate all English letters?

2014-10-04 Thread Peng Yu
Hi, seq can generate numbers easily. Is there an easy way to generate all English letters that anybody knows? -- Regards, Peng

Where are the OPTS bdfgiMhnRrV of --key of sort documented?

2014-12-25 Thread Peng Yu
Hi, I am trying to find the detailed meaning of bdfgiMhnRrV. But I can not find it in the manpage or the infopage. Does anybody know where are they documented? Thanks. -- Regards, Peng

Document for + seems to be missing in ls' document

2015-03-11 Thread Peng Yu
Hi, It seems that the document for ls in coreutils does not have an explanation of +. Should this be added? Thanks. http://serverfault.com/questions/227852/what-does-a-mean-at-the-end-of-the-permissions-from-ls-l -- Regards, Peng

Re: Document for + seems to be missing in ls' document

2015-03-11 Thread Peng Yu
On Wed, Mar 11, 2015 at 4:25 PM, Eric Blake wrote: > On 03/11/2015 03:13 PM, Peng Yu wrote: >> Hi, >> >> It seems that the document for ls in coreutils does not have an >> explanation of +. Should this be added? Thanks. >> >> http://serverfault.com/question

-e missing for ls on Mac OS X

2015-03-12 Thread Peng Yu
Hi, Mac OS X's ls has an option -e which related with ACLs. But coreutils' ls does not have this option, which make coreutils' ls not a complete replacement of Mac OS X's ls. Is it possible to add this feature to coreutils' ls? -- Regards, Peng

Re: Document for + seems to be missing in ls' document

2015-03-13 Thread Peng Yu
> That's one of the reasons that I _like_ the 'html' version of the > manuals MUCH more than the 'info' version - you can choose to view the > entire manual at once, at which point, a simple 'ctrl-f' will let your > browser find the relevant text within the manual regardless of the > 'texinfo's div

Is there a way to inherent the permissions related with o from the parent directory?

2015-03-17 Thread Peng Yu
Hi, Is there a way to inherent the permissions related with o from the parent? For example, if the parent has the permission --- for o, when I mkdir a subdirectory, I want to subdirectory also has the permission --- for o. Is possible to somehow chmod of parent to allow this to happen? -- Regar

Does sort handle -t / correctly

2015-04-17 Thread Peng Yu
Hi, I got the following results when I call sort with -t /. It seems that 'a/1.txt' should be right after 'a'. Is it the case? Or I am not using sort correctly? $ printf '%s\n' a 'a!' ab aB a/1.txt | sort -t / -k 1 -k 2 -k 3 -k 4 a a! a/1.txt aB ab -- Regards, Peng

Re: Does sort handle -t / correctly

2015-04-17 Thread Peng Yu
On Fri, Apr 17, 2015 at 11:26 AM, Eric Blake wrote: > On 04/17/2015 10:10 AM, Peng Yu wrote: >> Hi, I got the following results when I call sort with -t /. It seems >> that 'a/1.txt' should be right after 'a'. Is it the case? Or I am not >> using sort

Re: Does sort handle -t / correctly

2015-04-17 Thread Peng Yu
On Fri, Apr 17, 2015 at 12:31 PM, Eric Blake wrote: > On 04/17/2015 11:03 AM, Peng Yu wrote: >> On Fri, Apr 17, 2015 at 11:26 AM, Eric Blake wrote: >>> On 04/17/2015 10:10 AM, Peng Yu wrote: >>>> Hi, I got the following results when I call sort with -t /. It seems

Re: Does sort handle -t / correctly

2015-04-17 Thread Peng Yu
On Fri, Apr 17, 2015 at 2:05 PM, Peng Yu wrote: > On Fri, Apr 17, 2015 at 12:31 PM, Eric Blake wrote: >> On 04/17/2015 11:03 AM, Peng Yu wrote: >>> On Fri, Apr 17, 2015 at 11:26 AM, Eric Blake wrote: >>>> On 04/17/2015 10:10 AM, Peng Yu wrote: >>>>>

ls does not show broken like in red (coreutils installed from MacPorts)

2015-04-24 Thread Peng Yu
Hi, `ls` does not show broken links in red. Does anybody know what is wrong? I show the things with ls below. /tmp$ echo $LS_COLORS /tmp$ dircolors LS_COLORS='rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:

Is `ls` exactly the same as `dir`?

2015-05-12 Thread Peng Yu
Hi, It seems that `ls` and `dir` are exactly the same after I read the man pages. Is it the case? -- Regards, Peng

Why cp a directory into itself still create an empty directory?

2015-06-14 Thread Peng Yu
Hi, The following code shows that cp a directory into itself still create the tmp directory in the destination. Is better not to create it? /tmp$ mkdir tmp /tmp$ $(type -P cp) -r tmp tmp /usr/local/opt/coreutils/libexec/gnubin/cp: cannot copy a directory, ‘tmp’, into itself, ‘tmp/tmp’ /tmp$ ls -

What is the best way to touch a file and set its time of the last time of a bunch of other files?

2015-08-07 Thread Peng Yu
Hi, `touch -r` allows one to set the time of a file same as a reference file. What if one wants to set the time to be the last time of multiple files? Is there an easy way to do so? -- Regards, Peng

How to ignore an empty file with paste

2016-03-04 Thread Peng Yu
Hi, This example shows that an empty file will be used to create an empty column. But in some cases, it makes more sense to just ignore such a column. Is there a way to instruct paste to ignore an empty file? $ > empty_file $ paste empty_file <(seq 3) 1 2 3 -- Regards, Peng

ls when some directory only has one file/dir?

2016-05-31 Thread Peng Yu
Hi, github can directly show the nested dir when a directory only has one subdir (e.g., inst/include on the following webpage). https://github.com/imbs-hl/ranger/tree/master/ranger-r-package/ranger I think that this is a good idea. Maybe this feature should be included in ls as well? -- Regards

Is there a way to specify the next business day in date?

2016-08-12 Thread Peng Yu
Hi, I don't see a way to specify the next business day in date. Does anybody see if it is possible with date? -- Regards, Peng

Does -e overrule -f in readlink?

2016-09-24 Thread Peng Yu
Hi, It seems that -e overrules -f in readlink at least according to the following. If so, when -e is specified, specification of -f does not change the result of readlink. Is it the case? tmpdir=$(mktemp -d) cd "$tmpdir" ln -s z.txt d.txt readlink -f d.txt readlink -f -e d.txt || echo "$?" readlin

Sort differently on mac with some LC_ALL

2016-12-10 Thread Peng Yu
On mac, all the following LC_ALL result in the same results of sort. LC_ALL=en_US.UTF-8 sort <<< $'a\nb\nA\nB' A B a b LC_ALL=en_US sort <<< $'a\nb\nA\nB' A B a b LC_ALL=C sort <<< $'a\nb\nA\nB' A B a b But they are not all the same on linux. Do anybody know a LC_ALL on mac that would make sort

[coreutils] Additional suffix for split

2010-06-16 Thread Peng Yu
I need to add an additional common suffix to the files splited by split. Right now, I have to use mv to do so. But I feel it is convenient to have an option to add the suffix. Is this feature going to be considered to be added in the future? -- Regards, Peng

[coreutils] How to check uniqueness on one or multiple columns in a table and print the duplicated rows?

2010-06-17 Thread Peng Yu
Hi, Uniq doesn't have an option to check the uniqueness for a given column (although it can exclude the first a few columns). It will need 'cut' to check uniqueness on a give number of columns and print the duplicated rows. This is not convenient. I'm wondering if there is a better way to do so.

[coreutils] strange behavior of parallel ln across filesystems?

2010-07-06 Thread Peng Yu
I have the following makefile, which calls ln. The error only shows up (but not 100% percent of the time) if $(OUTDIR) and the current dir is not in the same file system (say one is on /dev/sde1 and the other is on /dev/sdb1). It might be something wrong with the filesystem. But could you please le

[coreutils] How to figure out all the hard links that link to the same file?

2010-07-26 Thread Peng Yu
Hi, If I inspect the results from 'stat', I know that the file 'a' and 'b' are the same. But if I only know 'a', is there a way to figure out that what other hard links are linked to 'a'? $ touch a $ ln a b $ stat a File: `a' Size: 0 Blocks: 0 IO Block: 1048576 regular

[coreutils] How to change the "Change" time? (touch)

2010-08-06 Thread Peng Yu
Hi, It seems that the 'change' time is not changed to yesterday. Could anybody let me know how to change the 'change' time? $ touch -d yesterday dir1/ $ stat dir1/ File: `dir1/' Size: 28 Blocks: 0 IO Block: 4096 directory Device: 811h/2065d Inode: 3003590786 Link

Re: bug#6554: [coreutils] Additional suffix for split

2011-02-13 Thread Peng Yu
On Fri, Jul 2, 2010 at 2:51 PM, Eric Blake wrote: > [adding bug-coreutils, to create a bug id to track this by] > > On 06/15/2010 09:23 PM, Peng Yu wrote: >> I need to add an additional common suffix to the files splited by >> split. Right now, I have to use mv to do

Faster ls when there are thousands of files in a directory

2011-06-24 Thread Peng Yu
Hi, When there are a few thousands of files/directories in a directory that I want to ls, I experience long wait time (a few seconds on mac). I'm wondering if some kind of cache can be built for ls to speed it up? Note my ls is installed from macport (not the native mac ls). -- Regards, Peng

typo in man ls?

2011-06-25 Thread Peng Yu
Hi, "Sort entries alphabetically if none of -cftuvSUX nor --sort." I suspect that there is a typo in the above sentence from man ls. Should it be "Sort entries alphabetically if none of -cftuvSUX nor --sort exists."? -- Regards, Peng

Re: Faster ls when there are thousands of files in a directory

2011-06-25 Thread Peng Yu
On Sat, Jun 25, 2011 at 12:54 AM, Jim Meyering wrote: > Peng Yu wrote: >> When there are a few thousands of files/directories in a directory >> that I want to ls, I experience long wait time (a few seconds on mac). >> I'm wondering if some kind of cache can be built for

sort's --key argument

2011-06-27 Thread Peng Yu
Hi, I want to sort by the 2nd column (see the 2nd command). But it seems that it still sorts by the second column then by the first column. Does anybody know how --key works? $ cat input.txt u a c c a a e e p a m e a a l e a a $sort --key=2,2 input.txt a a a a a a p a u a c c e e l e m e $sort --

What is the 'associated field'? (about sort)

2011-07-01 Thread Peng Yu
Hi, The following explanation for coreutils manual is not very clear. "Also note that the ‘n’ modifier was applied to the field-end specifier for the first key. It would have been equivalent to specify ‘-k 2n,2’ or ‘-k 2n,2n’. All modifiers except ‘b’ apply to the associated field, regardless of

Extend readlink -e

2011-11-04 Thread Peng Yu
Hi, readlink -e current returns nothing if the argument is not a symbolic link. I feel that it might be convenient to add an additional option to print the file/dir even the argument is not a symbolic link. Would the maintainer of readlink consider adding such an option? Thanks! -- Regards, Peng

Re: Extend readlink -e

2011-11-04 Thread Peng Yu
must exist On Fri, Nov 4, 2011 at 11:17 AM, Eric Blake wrote: > On 11/04/2011 10:15 AM, Peng Yu wrote: > >> Hi, >> >> readlink -e current returns nothing if the argument is not a symbolic >> link. >> I feel that it might be convenient to add an additional opt

Re: Extend readlink -e

2011-11-04 Thread Peng Yu
Hi Eric, I think that you might misunderstood my point. > The current wording in the manual (that is, the info pages) is: > > `Canonicalize mode' >     `readlink' outputs the absolute name of the given file which >     contains no `.', `..' components nor any repeated separators (`/') >     or sy

uniq without the need of sort

2011-11-08 Thread Peng Yu
Hi, 'uniq' currently relies on 'sort'. When the input file is small, this is OK. But when the input file is large, this seems to be a waste (the complexity is O(n log(n)), if uniq handles a hash table its self the complexity is only O(n)). I'm wondering if it is better to relax the requirement of

How to make a temp fifo?

2011-11-11 Thread Peng Yu
Hi, I'm wondering if there is a way to make a temp fifo. I could use the following to generate a temp fifo. But I'm wondering what is the safest way to generate a temp fifo. file=`mktemp -u` mkfifo $file rm $file -- Regards, Peng

Re: How to make a temp fifo?

2011-11-11 Thread Peng Yu
On Fri, Nov 11, 2011 at 12:38 PM, Eric Blake wrote: > > On 11/11/2011 11:36 AM, Peng Yu wrote: >> Hi, >> >> I'm wondering if there is a way to make a temp fifo. I could use the >> following to generate a temp fifo. But I'm wondering what is the >&g

Re: How to make a temp fifo?

2011-11-11 Thread Peng Yu
On Fri, Nov 11, 2011 at 12:47 PM, Eric Blake wrote: > On 11/11/2011 11:41 AM, Peng Yu wrote: >> On Fri, Nov 11, 2011 at 12:38 PM, Eric Blake wrote: >>> >>> On 11/11/2011 11:36 AM, Peng Yu wrote: >>>> Hi, >>>> >>>> I

command for relative path

2011-11-12 Thread Peng Yu
Hi, coreutils can give abspaths ('readlink -f -e'). But I'm not able to find a command for relative paths. I use the following python script to do so. The drawback is that it is dependent on python (meaning it is less portable). But I'm wondering if it is possible to add such a command (or an opti

Re: command for relative path

2011-11-12 Thread Peng Yu
On Sat, Nov 12, 2011 at 12:45 PM, Eric Blake wrote: > On 11/12/2011 09:16 AM, Peng Yu wrote: >> Hi, >> >> coreutils can give abspaths ('readlink -f -e'). But I'm not able to >> find a command for relative paths. > > I had to go chase down python d

Re: command for relative path

2011-11-12 Thread Peng Yu
On Sat, Nov 12, 2011 at 2:41 PM, Bjartur Thorlacius wrote: > On Sat, 12 Nov 2011 20:20:57 -0000, Peng Yu wrote: >> >> Should this be added to an existing coreutils' command or add a new >> command to coreutils? Personally I'd prefer to add a command called &

Re: command for relative path

2011-11-13 Thread Peng Yu
On Sun, Nov 13, 2011 at 12:45 PM, Dmitry V. Levin wrote: > Hi, > > On Sat, Nov 12, 2011 at 11:45:56AM -0700, Eric Blake wrote: > [...] >> http://docs.python.org/library/os.path.html >> >> os.path.relpath(path[, start]) >> >> >> >>     Return a relative filepath to path either from the current dire

Re: command for relative path

2011-11-13 Thread Peng Yu
> would you care to submit a patch? Hi, I have finished relpath.c. When I push it (after commit), I get the following error. I'm new to git. Does anybody know what the problem is? And how to get my patch to the central git repository? ~/coreutils$ git push fatal: The remote end hung up unexpecte

Re: command for relative path

2011-11-14 Thread Peng Yu
format-patch --stdout -1 > DIFF ~/coreutils$ cat DIFF >From fc71bbd211a7b9bb37d7a231a0507d8b8f5b14b1 Mon Sep 17 00:00:00 2001 From: Peng Yu Date: Mon, 14 Nov 2011 07:03:12 -0600 Subject: [PATCH] maint: Add src/relpath.c --- src/relpath.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-)

Re: command for relative path

2011-11-14 Thread Peng Yu
2011/11/14 Pádraig Brady : > On 11/14/2011 01:46 PM, Peng Yu wrote: >>> However, please do us (and yourself) a favor by reading and applying >>> the guidelines in HACKING before posting your patch. >> >> I had committed more than one times. The following comman

PATCH: relpath

2011-11-30 Thread Peng Yu
repository? -- Forwarded message -- From: Peng Yu Date: 2011/11/14 Subject: Re: command for relative path To: Pádraig Brady Cc: Coreutils 2011/11/14 Pádraig Brady : > On 11/14/2011 01:46 PM, Peng Yu wrote: >>> However, please do us (and yourself) a favor by reading

Re: PATCH: relpath

2011-12-01 Thread Peng Yu
> realpath [-s|--strip] [-z|--zero]  filename  ... I'm not sure why you and Jim want to merge a different function under the name realpath. To me, I think this less intuitive. The English word 'real path' is different from the word 'relative path'. If 'relpath' is used, probably don't need to read

Re: PATCH: relpath

2011-12-01 Thread Peng Yu
> Given there are existing realpath utils in both BSD and Debian, It is not necessarily everybody knows realpath. By default ubuntu doesn't have realpath installed. I'm not sure we should make the name less obvious than it should be just because there is a different that happen share some commonal

Re: PATCH: relpath

2011-12-01 Thread Peng Yu
Hi Jim, >    realpath --relative-start=DIR FILE ... I had some private email conversation with Eric. Per Eric's suggestion, it is better to document it to the mailing list for future reference and to make my point clearer. Just that there is a 3rd party command realpath (which doesn't have the r

What does 'safely' mean in man mktemp?

2011-12-14 Thread Peng Yu
Hi, man mktemp says "Create a temporary file or directory, safely, and print its name." I'm wondering what it means by "safely". Does mktemp test if there is already a tempfile with the given name? If there is indeed with the same file name, will mktemp use a different name rather than overwrite

Re: What does 'safely' mean in man mktemp?

2011-12-16 Thread Peng Yu
On Wed, Dec 14, 2011 at 8:37 PM, Bob Proulx wrote: > Peng Yu wrote: >> man mktemp says "Create a temporary file or directory, safely, and >> print its name." >> >> I'm wondering what it means by "safely". >> >> Does mktemp test if

Re: What does 'safely' mean in man mktemp?

2011-12-16 Thread Peng Yu
Hi Eric, > The GNU Coding Standards requires info documentation, not man > documentation.  They also require concise --help output. I can understand that the --help should be concise as it is not easy to read a long screen output. And this is generally what other packages do. But the following is

Re: What does 'safely' mean in man mktemp?

2011-12-16 Thread Peng Yu
> It is a matter of perspective.  The point is that we are building a > GNU operating system.  The preferred documentation format for GNU is > info format not man format. I never said to get rid of info. I'm not sure what you referred to here. > If you are running a non-GNU system and are only us

Re: What does 'safely' mean in man mktemp?

2011-12-18 Thread Peng Yu
> If you were creating a new GNU program from scratch and were starting > to write documentation for it then the format of that documentation > would be expected to be texinfo format.  Documentation in the format > of a man page is optional.  It might not exist at all. I have seldom seen a well de

cat -n with different format?

2011-12-22 Thread Peng Yu
Hi, I want to change how the line number is displayed ~$ echo a | cat -n 1 a For example, I want it to be shown as 1:a Although this can be easily done in anything other scripting language, I'm wondering if there is an even easier way to get it done with cat. -- Regards, Peng

Where are MbdfghinRrV of sort -k documented?

2012-01-22 Thread Peng Yu
Hi, http://www.gnu.org/software/coreutils/manual/html_node/sort-invocation.html I don't find where MbdfghinRrV is documented. "A position in a sort field specified with -k may have any of the option letters ‘MbdfghinRrV’ appended to it..." Are these options documented somewhere else? -- Regar

Adding humanize_number to coreutiles?

2012-02-06 Thread Peng Yu
Hi, Several commands in coreutils have the -h option. I'm wondering whether anybody in the develop team also thinks that it is worthwhile to export it as a standalone command. If so, I'd recommend add such convenient command in coreutiles. As I don't find it anywhere else as a stand alone command.

uniq --accumulate

2012-02-07 Thread Peng Yu
Hi, Suppose that I have a table of the following, where the last column is a number. I'd like to accumulate the number of rows that are the same for all the remaining columns. A 1 A 3 X 2 X 3 Y 3 The result will be the following. Although this is can be easily done by awk, etc, I'm wondering if

Re: uniq --accumulate

2012-02-07 Thread Peng Yu
On Tue, Feb 7, 2012 at 10:21 AM, Assaf Gordon wrote: > Pádraig Brady wrote, On 02/07/2012 11:00 AM: >> On 02/07/2012 03:56 PM, Peng Yu wrote: >>> >>> Suppose that I have a table of the following, where the last column is >>> a number. I'd like to accumu

Re: uniq --accumulate

2012-02-07 Thread Peng Yu
>        (1)  The input file/stream should be sorted/grouped by the -grp. > columns Do you actually mean that the rows are treated just like uniq does? I.e, only adjacent rows are subjected to grouping? If so, the document should be reworded to reflect this meaning. -- Regards, Peng

Re: uniq --accumulate

2012-02-07 Thread Peng Yu
>        -o -ops         Specify the operation that should be applied to opCol. >                        Valid operations: >                            sum, count, min, max, >                            mean, median, mode, antimode, >                            stdev, sstdev (sample standard dev.),

sort complexity on nearly sorted input

2012-02-11 Thread Peng Yu
Hi, I assume the time complexity of 'sort' is log N, where N is the input size. But I'm not familiar with 'sort' enough to tell the complexity of sorting a nearly sorted input. Suppose that I have a listed of N numbers, there only k numbers (k << N, say k=N/100) that are not in the correct positi

Re: sort complexity on nearly sorted input

2012-02-11 Thread Peng Yu
On Sat, Feb 11, 2012 at 10:20 AM, Peng Yu wrote: > Hi, > > I assume the time complexity of 'sort' is log N, where N is the input size. ^ typo. Should be N log N > > But I'm not familiar with 'sor

join on multiple field

2012-02-12 Thread Peng Yu
Hi, It seems that 'join' only allow joining on 1 field. It will be very useful to allow multiple field join. Is anybody in the develop team interested in adding such a feature in join? http://lists.gnu.org/archive/html/bug-coreutils/2004-03/msg00089.html -- Regards, Peng

Re: Adding humanize_number to coreutiles?

2012-02-12 Thread Peng Yu
2012/2/7 Pádraig Brady : > On 02/07/2012 03:36 AM, Peng Yu wrote: >> Hi, >> >> Several commands in coreutils have the -h option. I'm wondering >> whether anybody in the develop team also thinks that it is worthwhile >> to export it as a standalone

Confusion in 'join' manual?

2012-02-12 Thread Peng Yu
Hi, The following description is confusing to me. Since "--nocheck-order" is default, I'm wondering how can I not to give it? I tried specifying --nocheck-order in the command line, the warnings disappear. So by default, --nocheck-order is not specified? ".. If the option ‘--nocheck-order’ is gi

Re: join on multiple field

2012-02-13 Thread Peng Yu
> Can't you already do this with awk? This is not a very useful comment. Everything that coreutils do can be done with some other software. Since 'join' can do 1 field join, it is natural to ask for multiple field join. After all, people use coreutils for its convenience in certain aspects. Why no

How to explicte specify -t be the "non-blank to blank transition"?

2012-03-28 Thread Peng Yu
Hi, I don't see a way to explicit set -t to "non-blank to blank transition", although implicit it is set so. Is there a way to explictly set -t to "non-blank to blank transition"? More general, is there a way to set the separator to other transitions? -t, --field-separator=SEP

using tee with mkfifo

2012-04-27 Thread Peng Yu
Hi, The following code hangs there for ever. I don't understand what is going on. Basically, I tee stdin to two named pipes and cat both pipes. Could anybody let me know what I am wrong? Thanks! mkfifo a.suffix b.suffix echo Hello World | tee a.suffix > b.suffix & cat a.suffix b.suffix -- Regar

Re: using tee with mkfifo

2012-04-27 Thread Peng Yu
On Fri, Apr 27, 2012 at 3:46 PM, Andreas Schwab wrote: > > > Peng Yu writes: > >> Hi, >> >> The following code hangs there for ever. I don't understand what is >> going on. Basically, I tee stdin to two named pipes and cat both >> pipes. Co

Why sort is differently on different machine?

2012-05-01 Thread Peng Yu
Hi, 'sort' behaves differently on linux and Mac OS X (see below). Does anybody know why there is a difference and how to make them the same? ~$ uname Linux ~$ (echo AA;echo Aa)|sort Aa AA ~$ locale LANG=en_US.UTF-8 LANGUAGE= LC_CTYPE="en_US.UTF-8" LC_NUMERIC="en_US.UTF-8" LC_TIME="en_US.UTF-8" LC

Re: PATCH: relpath

2012-05-12 Thread Peng Yu
> `--relative-base=BASE' >     Only output relative names when both the `--relative-to' and processed >     FILEs are descendants of BASE.  Otherwise output the absolute file name. >     Note this option honors the @option{-m} and @option{-e} options >     pertaining to file existence. '--relative

Re: PATCH: relpath

2012-05-14 Thread Peng Yu
On Mon, May 14, 2012 at 3:33 AM, Pádraig Brady wrote: > On 05/13/2012 04:27 AM, Peng Yu wrote: >>> `--relative-base=BASE' >>>     Only output relative names when both the `--relative-to' and processed >>>     FILEs are descendants of BASE.  Otherwise out

Is there a way to prompt error if 'ln -s'es target does not exist?

2012-05-15 Thread Peng Yu
Hi, I don't see an option of 'ln -s' that prompts some error if the target does not exist. In case that I miss anything, could anybody who are more familar with ln confirm with me? Thanks! -- Regards, Peng

What is the difference between --binary and the default of md5sum?

2012-07-06 Thread Peng Yu
Hi, I don't see any difference between the two md5sum commands (on Mac OS). ~/linux/test/gnu/gnu/coreutils/md5sum/--binary$ ./main.sh md5sum `which md5sum` which md5sum 02389bdcb510f7a2667f94c4264bebd8 /opt/local/libexec/gnubin/md5sum md5sum -b `which md5sum` which md5sum 02389bdcb510f7a2667f94c

cp with subdirectories following some pattern removed?

2012-07-11 Thread Peng Yu
Hi, I need to cp a directories with all the the subdirectories matching a pattern removed (ignore all the test* subdirectories). There can be many solutions to this problem. I'm wondering if anybody is aware of an easy and robust solution. Thanks! -- Regards, Peng

How to sort alphabetically?

2017-08-13 Thread Peng Yu
Hi, "B" is listed before "a". Is there a way to sort alphabetically (as in an English dictionary)? (I think LC_* might need to be used, but I am not sure what value it should be.) Thanks. $ printf '%s\n' a B c | sort B a c -- Regards, Peng

Is there a way to always put NA before (or after) numerical values in sort?

2017-12-08 Thread Peng Yu
Hi, I want to always put NA before (or after) numerical values being sorted. Is there a way to control this? Thanks. ~$ printf '%s\n' .1 1 NA | sort -k 1,1rg 1 .1 NA ~$ printf '%s\n' .1 1 NA | sort -k 1,1g NA .1 1 -- Regards, Peng

Speed up sort with concurrency

2018-01-14 Thread Peng Yu
Hi, I see that concurrency can be used to speed up mergesort in golang. Can this be implemented in sort in coreutils? Thanks. https://medium.com/@_orcaman/when-too-much-concurrency-slows-you-down-golang-9c144ca305a -- Regards, Peng

Why cut treats one column input differently for out-of-range field spec?

2018-01-17 Thread Peng Yu
Hi, If there is only one column in the input, then an out-of-range field spec will result in the print of the whole line. $ cut -f 3 <<< $'a' | xxd 000: 610a a. Otherwise, an empty string is printed. $ cut -f 3 <<< $'a\tb' | xxd 000: 0a

Why is `find -name '*.txt'` much slower than '*.txt' on glusterfs?

2018-01-19 Thread Peng Yu
Hi, There are ~7000 .txt files in a directory on glusterfs. Here are the run time of the following two commands. Does anybody know why the find command is much slower than *.txt. Is there a way to change the api that `find` uses to search files so that it can be more friendly to glusterfs? $ time

Mapping of the special characters to the control sequences available?

2018-02-09 Thread Peng Yu
Hi, The following URL says control-v followed by control-m will insert a CR. https://superuser.com/questions/942217/how-do-i-interactively-type-r-n-terminated-query-in-netcat?answertab=active#tab-top I understand control-v is to enter the next character typed literally. And control-m is a CR. h

Is there a way to print unicode characters and the actual code?

2018-02-24 Thread Peng Yu
It seems that `od` does not respect the unicode. Is there a tool (maybe different from od) that can print the code in odd lines and the unicode character in even lines? Thanks. $ od -xc <<< 'exámple' 0007865a1c3706d656c000a e x ? ? m p l e \n 0

  1   2   >