[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: global feature request: allow blanks in filenames
From: |
Tony E. Bennett |
Subject: |
Re: global feature request: allow blanks in filenames |
Date: |
Mon, 15 Jan 2001 12:14:57 -0500 |
>>>>> "Shigio" == Shigio Yamaguchi <address@hidden> writes:
>> Even though the blanks are very annoying (in many ways, not just
>> for global), I cannot change the filenames of existing code that
>> is shared by 100 developers.
Shigio> You mean blanks are annoying for you too?
Shigio> Some UNIX tools, like ctags(1) + vi(1), also use blank as a separator.
Shigio> Maybe, you cannot use them in your environment.
Shigio> If modification is good for people, it will be accepted by them, even if
Shigio> they are 10,000 people, I believe.
Yes, blanks are annoying since, as you say, many unix tools do
not handle them gracefully.
Most of the other people on the project use (non-unix) tools that
can handle blanks in filenames just fine. Renaming files in this
case is a very big deal.
>> The GNU sort command allows specification of the separator using
>> '-t SEPERATOR'. Maybe other sort commands do also.
Shigio> Can you tell me the command line to sort this file?
Shigio> (1) (2) (3)
Shigio> +----------------------------------------------------------
Shigio> |main 32 "./src/m in.c" main(argc, argv)
Shigio> |main 22 "./a b/f u n c.c" main(argc, argv)
Shigio> |func 5 ./abc/func.c func()
Shigio> |func2 10 ./abc/func.c func2()
Shigio> |...
Shigio> We must sort this file by (1), (3) and (2) in order.
I assume here you mean one sort with 3 keys 1,3,2 as above.
I think this would do it for keys 1,3, but not for key 2
(linenum). Assumes all filenames wrapped by '"'. I
$ sort -t '"' -k 1,1 -k 2,2
But if the input could be changed to look like this:
(1) (2) (3)
+----------------------------------------------------------
|main^ 32^ ./src/m in.c^ main(argc, argv)
|main^ 22^ ./a b/f u n c.c^ main(argc, argv)
|func^ 5^ ./abc/func.c^ func()
|func2^ 10^ ./abc/func.c^ func2()
then this command should do it:
$ sort -b -t '^' -k 1,1 -k 3,3 -k 2,2n
The '^' is field separator. '-b' says to ignore *leading* blanks
(left in for readability, but could be removed).
--tony