Re:Show HN: Notational `ls` - Never get lost in code again (...
by swaits on Tuesday September 06, 2011 @01:26AM
(#2964271)
[ Parent
| on HN ]
Re:Show HN: Notational `ls` - Never get lost in code again (...
by jacknagel on Tuesday September 06, 2011 @03:28AM
(#2964548)
Just for kicks, here's a (terribly ugly) pipeline that will display the contents of .nls and `ls`, with duplicates removed:
ls | cat .nls - | column -t -s: | sort -r | perl -ane 'print unless $x{$F[0]}++'
and then obviously just echo "dirname: description" >> .nls to append to the file.
I would be interested in seeing a better pipeline, one that doesn't need perl/awk/ruby/what have you to remove the duplicates correctly.
Re:Show HN: Notational `ls` - Never get lost in code again (...
by colanderman on Tuesday September 06, 2011 @01:24PM
(#2966354)
The join(1) command is designed to do exactly this:
join -a2 -t: <(sort .nls) <(ls | sort)
(I think this is different from your pipeline, in that your pipeline will print files in .nls that aren't actually in the directory.)
Re:Show HN: Notational `ls` - Never get lost in code again (...
by jacknagel on Tuesday September 06, 2011 @03:34PM
(#2966926)
Awesome.
Re:Show HN: Notational `ls` - Never get lost in code again (...
by newhouseb on Tuesday September 06, 2011 @04:37AM
(#2964705)
Oh hey, this is awesome! I thought about doing something like this but then opted for the (ultimately more flexible) python script.
Re:Show HN: Notational `ls` - Never get lost in code again (...
by newhouseb on Tuesday September 06, 2011 @01:32AM
(#2964290)
Is fine too, but you wont get non-annotated files. nls was designed to work within your normal workflow, i.e. doesn't require you to think about getting file notes in order to get them.