Tag Info

Hot answers tagged


I do so love *nix and love seeing the inventiveness that goes into some of these replies... Mine's not nearly as fancy on GNU Linux : alias ls='ls --color -h --group-directories-first'


Damn, I was too quick in asking, without doing a better research. Proper menu option is in here: Edit > Line Operations > Sort Lines in Ascending / Descending Order Select a few lines and your selection will be sorted. If there's no selection -- entire file will be sorted.


The easiest method is to use zsh, thanks to its glob qualifiers. print -lr -- $dir/**/$str*(om[1,10]) If you have GNU find, make it print the file modification times and sort by that. find -type f -printf '%T@ %p\0' | sort -zk 1nr | sed -z 's/^[^ ]* //' | tr '\0' '\n' | head -n 10 If you have GNU find but not other GNU utilities, use newlines as ...


Give this a try: sort -s -n -k 1,1 The -s disables 'last-resort' sorting, which sorts on everything that wasn't part of a specified key. The -k 1 doesn't actually mean "this field and all of the following" in the context of numeric sort, as you can see if you try to sort on the second column. You're merely seeing ties broken by going to the rest of the ...


Use this: find . -printf "%T@ %Tc %p\n" | sort -n printf arguments from man find: %Tk: File's last modification time in the format specified by k. @: seconds since Jan. 1, 1970, 00:00 GMT, with fractional part. c: locale's date and time (Sat Nov 04 12:02:33 EST 1989). %p: File's name.


Your sort may have the ability to do this for you: sort --version-sort


Use GNU coreutils >= 7.5: du -hs * | sort -h (Taken from this serverfault question) Man page Edit: You can check your versions using du --version and sort --version if you are using the GNU versions. If you're using homebrew you may need to use gdu and gsort.


For this particular example you could also do this: ls *.pdf | sort -k2 -th -n That is, sort numerically (-n) on the second field (-k2) using 'h' as the field separator (-th).


If you want, you can install GNU sort through GNU's coreutils package over Homebrew, which is a package manager for OS X. Running this would install Homebrew. ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" Then just follow the installation instructions. When Homebrew is installed, run brew install coreutils ...


You don't need to PHP or Python, just ls: man ls: -t sort by modification time -r, reverse order while sorting (--reverse ) -1 list one file per line find /wherever/your/files/hide -type f -exec ls -1rt "{}" +; If command * exits with a failure status (ie Argument list too long), then you can iterate with find. Paraphrased from: The maximum ...


Its a custom sort in the Data sorting. See here for more info.


As nixda mentioned in the comments, helper columns will make this possible. You have two options for maintaining the sheet afterward: Add all new IPs in the split helper columns. Repeat the Text-to-columns procedure for new additions. Here's the procedure: Select your IP column and click Data > Text-to-Columns Choose the Delimted option and click ...


The following command will list directories first, ordinary files second, and links third. ls -la | grep "^d" && ls -la | grep "^-" && ls -la | grep "^l" Also, it would make a great deal of sense to create an alias for this command to save keystrokes. Edit: If you want directories first, and then everything that is not a directory second, ...


To fix the first row select it and then select "Freeze Panes" from the "View" ribbon. To get sorting and filtering select the first row and then "Filter" from the "Data" ribbon.


Which Date column is this exactly? As mentioned here, Date is different from Date Created/Modified/Accessed (on Win7 at least, ought to be the same in Win8 as well). It might be slow if the former column type is used and Explorer is trying to extract EXIF data from the files. Try Date Created or Date Modified instead and see if it is still as slow. (If it ...


This is certainly a dirty workaround, but I figured out a way to do this thanks to @slhck's tip about locales. If a better answer comes along that would be more helpful to others, I'll certainly accept it since this pretty much only works for my specific problem. I set the locale to Spanish (Bolivian) so that the commas were treated like decimal points, ...


If by "name order" you mean a simple alphabetical sorting, you could just sort the find results, which works fine as long as the files do not contain a newline in their name: find "$PHOTODIR" -iname "*.jpg" | sort If you want to pass these as arguments to an image viewer—or any other command—you need to pipe them to xargs. This works out of the box as ...


IMO the best way to do this would be to use the programming/scripting language you know best and: load small.txt into an in-memory hash/map/associative array keyed on the words Process huge.txt line by line, adding the column looked up from the hash and writing the result into an output file Buffer input and output so that it happens in chunks of at least ...


For Mac users coreutils: brew install coreutils alias ls='ls --color -h --group-directories-first' Assuming your system is ready to homebrew:


If you are referring to GNU sort, it implements a variant of the merge sort algorithm. The coreutils are open source, so feel free to download them and take a look.


Couldn't you just extract the 4th and 5th characters into another cell and sort on that? B1: =mid(A1,5,2) Then sort on column b?


You need to press Ctrl-Opt-Cmd-Number instead of Ctrl-Cmd-Number. To get the sorting (instead of arranging) menu items, hold down Option. The implemented the Sort by/Arange by submenu somewhat oddly though, so pressing Option while it's already visible won't change the menu items.


Output redirection by the shell clears the file's contents before the sort command is run. From man bash: Before a command is executed, its input and output may be redirected using a special notation interpreted by the shell. [...] Redirection of output causes the file whose name results from the expansion of word to be opened for writing [...]. ...


Setting LC_ALL=C restored the traditional sorting order in my case. Package: coreutils Version: 8.5-1ubuntu3 export LC_ALL=C


Try this: awk '{print $0" "length($4)}' infile | sort -k5,5rn | sed -e 's/ [0-9]*$//' > outfile


To build on Michael Borgwardt's answer: as long as both files are sorted, you can put them together by basically performing one step of a mergesort. It'll be a little different than standard mergesort because you only want to keep one of the files. This will, of course, have to be implemented in your favorite programming language. Here's a sketch of the ...


Something like this might do what you want, though it takes a slightly different approach: pdftk $(for n in {1..18}; do echo cwcch$n.pdf; done) cat output output.pdf


To only sort on the first column you should do: sort -n -k1,1 From Unix and Linux System Administration Handbook sort accepts the key specification -k3 (rather than -k3,3), but it probably doesn’t do what you expect. Without the terminating field number, the sort key continues to the end of the line


I know it's an over a year topic (sorry about that) but i think someone may need the full working script, so here it is. Taking the ideas here and compiling into a script we get. #!/bin/bash for image in *.jpg; do res=$(identify -format %wx%h\\n $image); mkdir -p $res; mv $image $res; done


You do only need ls You could do find /wherever/your/files/hide -type f -exec ls -1rt "{}" +; as stated above, or ls -1rt `find /wherever/your/file/hides -type f`

Only top voted, non community-wiki answers of a minimum length are eligible