Re: Is natural sort supported?

2019-10-08 Thread Peng Yu
Some part of the manual is also poorly written. "1.1.2 Origin of version sort and differences from natural sort" After reading the above section, I am still not clear what is the difference. It is better to show some examples to illustrate the difference. On 10/8/19, Peng

Re: Is natural sort supported?

2019-10-08 Thread Peng Yu
> At the risk of arguing over semantics, > I'll say again: there is no "one correct" natural order standard, > and therefore it is not "plain and simple" because there is no just > "one" such order. I don't think there is no commonly accepted "natural sort". For example, I found another one that

Is natural sort supported?

2019-10-08 Thread Peng Yu
Hi, The following example shows that version sort is not natural sort. Is natural sort supported in by `sort`? $ printf '%s\n' G . | LC_ALL=C sort -k 1,1V . G $ printf '%s\n' 1G 1. | LC_ALL=C sort -k 1,1V 1. 1G $ printf '%s\n' 1G13 1.02 | LC_ALL=C sort -k 1,1V # The result order should have been

Can natural sort support be added?

2019-10-08 Thread Peng Yu
Hi, Since natural sort is provided in a few languages (as mentioned in the Wikipedia page). Can it be supported by `sort` besides just version-sort? https://en.wikipedia.org/wiki/Natural_sort_order -- Regards, Peng

sort by hex number?

2020-03-05 Thread Peng Yu
I have a TSV file with a column in hex format, e.g., 0x1a000, 0x17000, 0xe000. Is there a way to sort the rows by this column in hex? Thanks. -- Regards, Peng

Re: Show directory time as the latest time of the file in the directory (including subdirs)

2020-01-29 Thread Peng Yu
No. -t just shows the time of the directory itself. I want a summary time which is the latest time of all the contents (including the ones in the subdirecties, subsubdirs,...) in the directory. On 1/29/20, Bernhard Voelker wrote: > On 1/29/20 10:58 AM, Peng Yu wrote: >> Hi, >> >

Re: What is the difference between unlink and rm -f?

2020-01-29 Thread Peng Yu
So a one-line summary is When the target can be delete, unlink and rm -f are the same; otherwise, unlink will complain about the error and exit with 1, but rm -f will do neither. On 1/29/20, Kaz Kylheku (Coreutils) <962-396-1...@kylheku.com> wrote: > On 2020-01-29 01:45, Peng Yu wro

What is the difference between unlink and rm -f?

2020-01-29 Thread Peng Yu
Hi, It seems to me unlink and rm -f are the same if the goal is the delete files. When are they different? Thanks. -- Regards, Peng

Show directory time as the latest time of the file in the directory (including subdirs)

2020-01-29 Thread Peng Yu
Hi, For directories, ls shows in the time of the directory itself. Sometimes, it is more important to show the latest time of files in the directory in addition to the directory time. Is there an easy way to show such information? Thanks. -- Regards, Peng

how to use touch to change change time?

2020-01-19 Thread Peng Yu
Hi, I don't see how to change change time by touch. Is it possible with touch? Thanks. --time=WORD change the specified time: WORD is access, atime, or use: equiv- alent to -a WORD is modify or mtime: equivalent to -m -- Regards, Peng

altchars for base64

2020-03-14 Thread Peng Yu
Hi, Python base64 decoder has the altchars option. https://docs.python.org/3/library/base64.html base64.b64decode(s, altchars=None, validate=False)¶ But I don't see such an option in coreutils' base64. Can this option be added? Thanks. -- Regards, Peng

Which sha sum is the fastest?

2020-04-27 Thread Peng Yu
I got the following run time on a file of 116M. They are ranked in this order. Is this runtime order in general true? sha1sum < sha384sum <~ sha512sum < sha256sum <~ sha224sum ==> sha1sum <== real0m0.330s user0m0.275s sys 0m0.042s ==> sha224sum <== real0m0.679s user

How to ls a directory with the directory path prepended?

2020-04-27 Thread Peng Yu
When I `ls` a directory, the content will be shown without the directory path. Is there an option of `ls` to prepend the directory path? Note that I am not looking for this way, as it involves shell. ls d/* Thanks. -- Regards, Peng

Does -s apply to -m in sort?

2020-05-09 Thread Peng Yu
It seems that -s of sort is not useful when -m is used based on my simple test case. But I am not completely sure. Could anybody let me know if this is the case? Thanks. -- Regards, Peng

Re: Does -s apply to -m in sort?

2020-05-11 Thread Peng Yu
Are you the author of -m? If not, maybe the author of -m should knows how it works with -s? If not, maybe this should be documented anyway? On Mon, May 11, 2020 at 5:01 PM Eric Blake wrote: > On 5/11/20 4:18 PM, Peng Yu wrote: > > I used real files (already sorted) to test whether

Re: Does -s apply to -m in sort?

2020-05-11 Thread Peng Yu
to authors who made -m and -s. My question should be clear? On 5/11/20, Eric Blake wrote: > On 5/9/20 4:31 PM, Peng Yu wrote: >> It seems that -s of sort is not useful when -m is used based on my >> simple test case. But I am not completely sure. Could anybody let me >> kno

Better support of timezone abbreviation in `date`?

2020-10-09 Thread Peng Yu
Hi, It looks like some time zone abbreviations are not supported by `date`. For example, THA is not supported. Can a more comprehensive support be added? Thanks. https://www.timeanddate.com/time/zone/thailand -- Regards, Peng

What timezone strings are supported by `date`?

2020-10-09 Thread Peng Yu
Hi, It seems that time zone string like CET, PST are supported by `date`. But I don't find a complete list of such strings supported by `date`. Is there a doc that describe all of them? Thanks. -- Regards, Peng

How tail works on a large file?

2020-08-22 Thread Peng Yu
Hi, I tried to tail a large file (2.8GB) to get is last 10 lines. It runs very fast. How is this achieved? Does tail do it differently between a file (random disk access) and a pipe (sequential disk access)? Thanks. -- Regards, Peng

What is the interpretation of bs of dd in terms of predicting the disk performance of other I/O bound programs?

2020-09-23 Thread Peng Yu
Hi, Many people use dd to test disk performance. There is a key option dd, which I understand what it literally means. But it is not clear how there performance measured by dd using a specific bs maps to the disk performance of other I/O bound programs. Could you anybody let me know the

../.. resolution of ls

2020-06-07 Thread Peng Yu
Hi, It seems that ../../ can not be resolved symbolically by ls. See the following example. I'd like `ls ..` to print both a and b. Unfortunately, it only print b because it thinks it is in /tmp/i/a/b instead of /tmp/i/b. Is there a way to use symbolic pwd instead of abs pwd? Thanks. /tmp/i$

How to ensure UTF-8 sort?

2020-12-06 Thread Peng Yu
Hi, I want to make sure sort is always use UTF-8. But I am not sure what locale is universally available on all OSes. Does anybody know what is the correct way to make sure sort by UTF-8 in all machines that coreutils is installed? Thanks. -- Regards, Peng

make ls -l dir1 dir2 in the same order as dir1,2 are specified

2021-03-26 Thread Peng Yu
Hi, When I try `ls -l dir1 dir2`, the order of dir1 and dir2 in the output is not necessarily the same as the input. How to make it the same as the input order? Thanks. -- Regards, Peng

od and UTF-8

2021-04-01 Thread Peng Yu
Hi, I am wondering whether there is a way to do something similar to od, but respect UTF-8 characters. For example, instead of print this, $ od -c -t x1 -Ax <<< α 00 � � \n ce b1 0a 03 I want to print this. Basically, if it is a printable UTF that does not require

Re: differece between mkfifo and mknod ... p

2021-03-24 Thread Peng Yu
On Wed, Mar 24, 2021 at 4:52 PM Bob Proulx wrote: > > Peng Yu wrote: > > It seems that both `mkfifo` and `mknod ... p` can create a fifo. What > > is the difference between them? Thanks. > > The mknod utility existed "for a decade" in Unix (don't quote me on &

differece between mkfifo and mknod ... p

2021-03-12 Thread Peng Yu
Hi, It seems that both `mkfifo` and `mknod ... p` can create a fifo. What is the difference between them? Thanks. -- Regards, Peng

Re: differece between mkfifo and mknod ... p

2021-03-13 Thread Peng Yu
cfb88 /* 69 vars > */) = 0 > mknod("mkfifo", S_IFIFO|0666) = 0 > > $ ls -l mk* > prw-r--r-- 1 steeve steeve 0 Mar 13 08:45 mkfifo > prw-r--r-- 1 steeve steeve 0 Mar 13 08:45 mknod > > > > On Sat, Mar 13, 2021 at 8:38 AM Peng Yu wrote: > >&g

Print modification time in compact form

2021-03-15 Thread Peng Yu
Hi, I see modification time can be printed in this format. $ stat -c '%y' file.txt 2017-07-31 17:50:54.0 +0100 Is there a way to directly print it as 20170731-1750? Thanks. -- Regards, Peng

How to count the last line when it does not end with a newline character?

2021-09-04 Thread Peng Yu
I got 1 instead of 2 in the following example. How to count the last even when it does not end with a newline character? Thanks. $ printf 'a\nb'|wc -l 1 -- Regards, Peng

how to speed up sort for partially sorted input?

2021-08-07 Thread Peng Yu
Hi, Suppose that I want to sort an input by column 1 and column 2 (column 1 is of a higher priority than column 2). The input is already sorted by column1. Is there a way to speed up the sort (compared with not knowing column 1 is already sorted)? Thanks. -- Regards, Peng

Re: how to speed up sort for partially sorted input?

2021-08-11 Thread Peng Yu
On Wed, Aug 11, 2021 at 5:29 AM Carl Edquist wrote: > > On Tue, 10 Aug 2021, Kaz Kylheku (Coreutils) wrote: > > > On 2021-08-07 17:46, Peng Yu wrote: > >> Hi, > >> > >> Suppose that I want to sort an input by column 1 and column 2 (column >

Re: how to speed up sort for partially sorted input?

2021-08-11 Thread Peng Yu
On Wed, Aug 11, 2021 at 1:43 PM Kaz Kylheku (Coreutils) <962-396-1...@kylheku.com> wrote: > > On 2021-08-11 05:03, Peng Yu wrote: > > On Wed, Aug 11, 2021 at 5:29 AM Carl Edquist > > wrote: > >> (With just a bit more work, you can do all your sorting in a single &

How to get the past Mon/Tue/.. not after the current date?

2021-07-20 Thread Peng Yu
Hi, $ date -d 'last Tue' +%Y-%m-%d 2021-07-13 $ date +%Y-%m-%d 2021-07-20 $ date -d 'last Mon' +%Y-%m-%d 2021-07-19 I want to get the last day of week not in the future. In the above example, I want to get this Tue (2021-07-20) instead the last Tue (2021-07-13). But for Mon, I want to get

How to make mv -i return non zero status when uses choose n?

2023-01-07 Thread Peng Yu
Hi, When I use mv -i and choose n so that the destination will not be overwritten, the return status is still zero. Is there a way to let mv return nonzero status to reflect that n is chosen by the user? Thanks. -- Regards, Peng

mkdir -p competition on the same directory?

2023-02-09 Thread Peng Yu
https://lists.gnu.org/archive/html/help-bash/2023-02/msg00053.html Bash loadable `mkdir -p` has a problem when multiple loadable `mkdir -p` is called on the same directory simultaneously. But I never see coreutils' `mkdir -p` has the same problem. Does coreutils' `mkdir -p` do something extra to

Re: mkdir -p competition on the same directory?

2023-02-09 Thread Peng Yu
system call of mkdir. But since they find the target is already created and is a directory, they will not complain about the error system call mkdir. That is why I never see an error similar to that of bash loadable `mkdir -p`. Is it so? On 2/9/23, Pádraig Brady wrote: > On 09/02/2023 14:57,

head that accepts gz files?

2009-12-01 Thread Peng Yu
I'm wondering if there is a similar program to 'head' that accepts gz files. (just as zgrep to grep)

how to replace tab by '\t' (literally) with tr?

2009-12-28 Thread Peng Yu
I have the following file head.txt. I'm wondering what the correct way is to change the tab to a backslash and the character 't'. $ tr \t \\t head.txt a a b c $ cat head.txt a a b c

How to make the colors different for a symbol link pointing to a file and symbol link pointing to a dir?

2009-12-30 Thread Peng Yu
alias dir='ls --color=auto --format=vertical' The above alias doesn't distinguish the color for a symbol link pointing to a file and a symbol link pointing to a dir. I'm wondering if there is a way to configure it to do so?

Re: How to make the colors different for a symbol link pointing to a file and symbol link pointing to a dir?

2009-12-30 Thread Peng Yu
On Wed, Dec 30, 2009 at 7:34 PM, Eric Blake e...@byu.net wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Peng Yu on 12/30/2009 4:09 PM: alias dir='ls --color=auto --format=vertical' The above alias doesn't distinguish the color for a symbol link pointing to a file

Re: How to make the colors different for a symbol link pointing to a file and symbol link pointing to a dir?

2009-12-30 Thread Peng Yu
On Wed, Dec 30, 2009 at 8:47 PM, Eric Blake e...@byu.net wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Peng Yu on 12/30/2009 7:30 PM: Use dircolors (as in adding the line: eval `dircolors path/to/preferences` http://linux.die.net/man/5/dir_colors According

Re: How to make the colors different for a symbol link pointing to a file and symbol link pointing to a dir?

2009-12-31 Thread Peng Yu
On Thu, Dec 31, 2009 at 9:31 AM, Chris Jones cjns1...@gmail.com wrote: On Thu, Dec 31, 2009 at 07:28:05AM EST, Eric Blake wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Chris Jones on 12/30/2009 11:26 PM: But pardon my ignorance, where exactly do you specify LINK target?

How to ls (sorted by file size)?

2009-12-31 Thread Peng Yu
I don't see an option that sorts ls result by file size. Could somebody let me know if there is such an option?

How to overwrite the destination directory by 'cp'?

2010-01-21 Thread Peng Yu
Suppose I have directory a and b, the following command will copy the content of a to b/a, rather than overwrite the directory 'b' by the directory 'a'. I'm wondering if there is an option to overwrite 'b'? cp -r a b

How to create an empty file?

2010-01-25 Thread Peng Yu
'touch' will not make the file size empty if the file is not empty. I don't not want to use 'rm -f' first then touch because I might accidentally remove something if I type anything wrong. Could somebody let me a better way to create an empty file?

How to print the target of a symbolic link?

2010-03-06 Thread Peng Yu
'ls -l' shows the symbolic link and its target. I could parse the output. But I'm wondering whether there is a convenient command that only print the target if it is a symbolic link otherwise print nothing? Thank you for your help.

bug#6138: mv while maintaining relative symbolic links

2010-05-07 Thread Peng Yu
I'm wondering if there is any tool that can do almost exact the same thing as mv, but it can maintain symbolic links. mv doens't maintain relative symbolic links. For example, I have file /tmp/A/file1.txt and a symbolic link /tmp/file1.txt that point to A/file.txt (by the relative path). If I mv

bug#6138: mv while maintaining relative symbolic links

2010-05-08 Thread Peng Yu
On Fri, May 7, 2010 at 5:03 PM, Bob Proulx b...@proulx.com wrote: severity 6138 wishlist thanks Peng Yu wrote: I'm wondering if there is any tool that can do almost exact the same thing as mv, but it can maintain symbolic links. mv doens't maintain relative symbolic links. For example, I

bug#6138: mv while maintaining relative symbolic links

2010-05-10 Thread Peng Yu
On Mon, May 10, 2010 at 4:37 AM, Voelker, Bernhard bernhard.voel...@siemens-enterprise.com wrote: Peng Yu wrote: I agree with you that this is may not be possible for whole file system. But under the assumptions that symbolic links and their targets are always in a number of directories (user

bug#6251: How only show time of files with ls?

2010-05-22 Thread Peng Yu
ls -go gives me permission and file sizes. But I only want to show time and file names. Would you please let me know what command to use? -- Regards, Peng

bug#6356: How to avoid showing the 'total' line with wc -l?

2010-06-05 Thread Peng Yu
When I use wc -l *.txt, it show the total number of lines at the end. I don't necessary need this last line. Is there a way to disable it? -- Regards, Peng

bug#6379: process substitution with a give suffix

2010-06-08 Thread Peng Yu
On Tue, Jun 8, 2010 at 1:02 PM, Greg Wooledge wool...@eeg.ccf.org wrote: On Tue, Jun 08, 2010 at 12:53:47PM -0500, Peng Yu wrote: I have a program that only accept argument with a give suffix ./program xxx.suffix If I use process substitution, which gives me /dev/fd/xx, it will not work

bug#6393: The meaning of --key of sort command?

2010-06-10 Thread Peng Yu
Hi, I don't think that I completely understand what key means. In the following example, I thought that --key=2 should order the lines by the 2nd letter in each line without reordering the lines with the same 2nd letter. But it turns out my understanding is not correct. For example, u a was

bug#6393: The meaning of --key of sort command?

2010-06-10 Thread Peng Yu
On Thu, Jun 10, 2010 at 11:39 AM, Peng Yu pengyu...@gmail.com wrote: Hi, I don't think that I completely understand what key means. In the following example, I thought that --key=2 should order the lines by the 2nd letter in each line without reordering the lines with the same 2nd letter

bug#6394: Is it possible to reorder fields with cut?

2010-06-10 Thread Peng Yu
Hi, I need to reorder the fields in a file. But the -f option can not be used to reorder field 1 and field 2. Basically, I want the original 1st field as the new 2nd field and the original 2nd field the first. Is reordering fields possible with cut. $ cat input.txt a b c e f

bug#6395: How sort based on a list of fields?

2010-06-10 Thread Peng Yu
Hi, -k option of sort only allow a range of files. But I would like a list of fields. For example, field 7, field 3 then field 8. Would you please let me know how to do it? -- Regards, Peng

bug#6405: cp from -MM to -M

2010-06-11 Thread Peng Yu
I'm trying to cp -MM to -M. But so far I don't have a way to do it. Would you please let me know what is the correct way to cp from -MM to -M? $ cp -r -- -MM/ -- -M cp: target `-M' is not a directory $ ll -go total 0 drwx-- 2 64 2010-06-11 14:35 -MM -- Regards, Peng

bug#6442: About the modifier of -k option in sort

2010-06-16 Thread Peng Yu
Hello, The modifiers of -k are discussed in the examples in 'info sort' rather than in the main entry of -k. I feel that this be improved by clearly describe each modifier under the main entry of -k. It is not very clear to how many modifiers there are. -- Regards, Peng

bug#6442: About the modifier of -k option in sort

2010-06-17 Thread Peng Yu
2010/6/17 Pádraig Brady p...@draigbrady.com: On 17/06/10 03:07, Peng Yu wrote: Hello, The modifiers of -k are discussed in the examples in 'info sort' rather than in the main entry of -k. I feel that this be improved by clearly describe each modifier under the main entry of -k

bug#6554: [coreutils] Additional suffix for split

2011-02-13 Thread Peng Yu
On Fri, Jul 2, 2010 at 2:51 PM, Eric Blake ebl...@redhat.com 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 so. But I feel

bug#9611: Copy an item with its parent directory

2011-09-27 Thread Peng Yu
Hi, Suppose I have a file 'a/b/c/d/e/f', I want to copy it to 'target' with the parent 'd/e'. I.e., the resulted file is 'target/d/e/f'. I can make a bash script to do so, but I wondering if there is an existing command or option. Thanks! -- Regards, Peng

bug#13075: fifo unlimited buffer size?

2012-12-03 Thread Peng Yu
Hi, I have the following script. When the number to the right of 'seq' is large (as 10 in the example), the script will hang. But when the number is small (say 1000), the script can be finished correctly. I suspect that the problem is that there is a limit on the buffer size for fifo. Is it

<    1   2