Ubuntu :: 'sort', Not Sorting Some Characters, Just Ignoring?
Aug 28, 2010i used 'sort' to sort a 160k line file and looked though it and noticed this
RS:HALP
RS HD
RSHD
[code]....
i used 'sort' to sort a 160k line file and looked though it and noticed this
RS:HALP
RS HD
RSHD
[code]....
I am dragging my files over to a new Fedora 12 installation and I just noticed that special characters are not taken into account when sorting files by name (I want '_js' to come before 'images').Is there a way to make the sorting process behave like Windows, where files starting with a special character are listed first?
View 5 Replies View RelatedI have a bunch of text logfiles in the following format:
ID (17 characters)
Timestamp (14 characters YYYYmmddHHMMSS e.g. "20060210100040" -> 2006/02/10 10:00:40)
Random data (? characters)
end of line
The files are already sorted by timestamp.I need to get 1 log file with all the logs from multiple logs files, sorted by timestamp. Note that the log files are really huge, around 3-4G each (and there are dozens of them) I tried the following command:
sort -s -m -t '|' -k1n,1n +17 -o data_sort.txt *.TXT
Here is how I ended up with this command:
-s : don't bother with tie results
-m : merge all logs files
-t '|' : there is no | in my logs, so the whole line should be field 1
[code]....
Actually... it fails miserably. The output file data_sort.txt is just the concatenation of all files, not sorted at all.
I want to sort a number of lines based on their size:
data:
-------
12345678
87654321
1234
[code]....
Should output as:
-----------------
1
2
12
21
[code]....
But i'm gettings this with sort
----------------
1
12
123
1234
[code]....
Can we sort the above "data" text, based on "number of characters" instead of "character order"?
What command could I use in terminal to delete all ASCII characters? That is, delete a-z, A-Z, 0-9, and all punctuation? I have a file containing Chinese characters, and I want to remove everything else and leave just the Chinese.
I can use grep to leave only the lines that have Chinese in them, but this still leaves a lot of non-Chinese stuff on those lines. Does anyone know how I could actually remove everything that isn't Chinese?
While modifying the definition of my PS1, I saw that "[" and "]" markers should be added to help bash to compute the right display lenght. Many exemples on the web do not use them or even mention them.I searched for a solution to add them automatically, like with sed, but I didn't find any example.Are they still needed and is there a recommandation not to use sed to define PS1?
View 1 Replies View RelatedI have my OpenSuse 11.1 box set up with utf-8, however, every time I try to open a file with utf-8 characters with vi it can't handle those characters properly.
View 6 Replies View RelatedI download files onto my networked file server which is running Ubuntu 9.10.By default, all files are moved into the Downloads folder, I'd like to use a script or program to automatically send them into one of 5 shared folders based on what the file is.For example: archived files would be software by default, .avi or mpeg Videos, and .flac or .ogg would be Music.
View 1 Replies View RelatedFor completeness here's the history that got me to this point:
Stage 1
/dev/sda - disk with XP OS, set to be first boot disk in BIOS
/dev/sdb - a small data disk to supplement sda
[code]....
I'm currently trying to organize a media server so that things will be in some kind of logical order rather than the current setup of dumping everything of a certain content type into a single folder. However, the size and diversity of content within these disorganized folders precludes me doing things manually. Does anyone know of a program or script that could sort the files into folders based on part of a filename
View 7 Replies View RelatedWhat options should I use when I'm using the sort command to sort the top 5 CPU processes (ps -eo user,pid,ppid,%cpu,%mem,fname | sort ??? | head -5) showing max to min usage?
View 2 Replies View RelatedI was glad to see another release of exaile. I'm always happy to see improving mainstream desktop apps, especially when they start being much superior to their commercial counterparts in both, quality and quantity, of features. But as if developers are ignoring the simple usability problems - again - exaile like all other gnome music players (apart from amarok, but that's kde!) can't browse your library by album artist!
View 8 Replies View RelatedI've recently switched from Windows to Ubuntu and have a question regarding tweaking the character order Nautilus uses for alphabetical sorting. In my music/graphics/etc folder hierarchies, I have used a hyphen at the start as a 'hack' to 'sticky' some folders above the rest for quicker access. This worked fine in Windows, but Nautilus ignores a hyphen in it's sorting calculations. Is there anyway, simple or complex to replicate this behaviour in Nautilus?
View 4 Replies View RelatedSo I just had a quick question on logical volumes and such with ubuntu. I've been looking into setting up a storage array of 4 2tb hard drives for media storage in my house but have ran into a wall with with sort of array i should use, whether it be setting up a full raid system (raid 5 or 10 most likely) or using LVM for stripping. The one thing with LVM however, is that there is no parity or redundancy built into it in case 1 hard drive fails. I was wondering if it was possible to create something similar to that of LVM stripping, but instead the logical volume is sorted into whole individual files, not stripping them across the array. That way, if one drive fails, sure, i lose the contents of the one drive, but the rest of the content isn't lost and I have no loss of space because there is no inherent parity.
View 1 Replies View RelatedWe switched from unix to linux and we have an old report that extracted data from a database, output to an ascii file and then sorted the results in the file based on different arguments. The report now blows up when it runs,and I can only guess it is because the options for sort on linux differ slightly from unix.For example, here is one of the commands issued from within the report app that ran on the old unix box:
if sort-sequence = "descending" then
'sort -t~" -f +3.0f -4.0 +5.0r -6.0 -f '
else
'sort -t~" +3.0f -4.0 +1.0f -2.0 -f'
I will eventually rewrite the report to store the data in a local table, but I can simply adjust the options to suit the requirments of linux. Basically, I need to know if this can be a quick fix for the short term.
how to sort the 2 dimensional array below by column 1 then by column 2?
22 55
2222 2230
33 66
44 58
222 240
[Code].....
this is a small part in my awk script. the input data is not in file, but it was manipulated in my script.
I am trying to sort a file, so I can compare it to another file later. I am storing the file name in a variable called curMo. I then call sort $curMo and it hangs for a very long time and I have to quit the process. why this is not working or how to make it work?
Here is part of my code:
#sort this file for this Location
sort -u $curMo -o $curMo.sorted
I have some files in a directory like
file1.txt
file10.txt
file2.txt
[code]...
I have a list of list and I'd like to sort the list according to the last value of each row.
Let's say we have the list
L1 = [ [1,2] , [4,6] , [78,-3] ]
I wish to get
L2 = [ [78,-3] , [1,2] , [4,6] ]
Is there a simple way to do that in python?
I have this dictionary file that has this format:
SUBSTITUTE_VALUE, Real Value
SUBSTITUTE_VALUE_2, Real Big Value
SUBSTITUTE_VALUE_HECL, Hardware Abstract
SUBSTITUTE_V, Valley Mem
I want to sort this file so the LONGEST Substitute Values are listed at the top ( so SUBSTITUTE_VALUE_HECL would be first in the list). Obviously I want to keep the related values tagging along with them, so the whole first line would be
SUBSTITUTE_VALUE_HECL, Hardware Abstract
Playing with sort This has me pretty close: sort dict.file -k1.1n,1
Files downloaded with Firefox, Chromium, Miro etc. will not open correctly. Clicking to open the file (e.g. jpg or ogg) should result in the file opening with eog or audacious. Results - from Nautilus this works correctly, however from other applications the result is a Nautilus window. Placing a file 'test.torrent' on the desktop and using terminal to do
Code:
gnome-open test.torrent
or
Code:
xdg-open test.torrent
results in the same behaviour. However, simply clicking the file in Nautilus opens it in Deluge (correct behaviour).
Since this morning, in a normal Gnome session, all of my GTK apps, menus and icons (except, oddly for the Gnome panel) are using the same drab and boring style that they use when they're running as root. Which they're not.No one else uses this computer, and I've made no changes to any GTK-based or affecting settings, except to try to change the GTK controls, with no effect at all. So I cannot understand why this is happening.
View 4 Replies View RelatedI have a problem with sorting when locale is set to UTF-8 in Squeeze. Example:
echo -e "ą
a
b
c
[Code].....
why nautilus is sorting my files in such a weird way? I would think it would sort numerically by the first number, then second number, etc.
View 13 Replies View RelatedI love using htop, but I have noticed that whenever I sort by a parameter (for example, Shift+m for sorting by Memory usage), the htop stats stop dynamically refreshing. Is this intended? I also notice this with top as well.
View 1 Replies View RelatedI have a file like:
ER- V67
ER+ V68
ER- V69
ER+ V70
[Code]....
I am using the code:
sort -k1
but it prints it by sorting the second column.
The command: Code: ls -lRt Shows a recusrive listing, and sorts by modification time. But this in in tree fashion, where it first lists the contents of the current folder sorted by time, and then the contents of each child folder sorted by time. How would one accomplish this type of sort, but with an aggregate listing - all items recursively sorted together, rather than by individual folder?
View 3 Replies View Related(1)There should be a command to send content to clipboard instead of 36 buffers available in vi just like ':set paste' allows pasting from clipboard inside vi using ctrl+shift+v in insert mode.(Currently I select area using mouse & right click then copy )
2)Let us say I have sentence "I am young" I want to arrange the words in this line in alphabetical order so that I get 'am I young'. First I thought replacing space by in sentence.Then !#j then type sort -n where # represents number of words.Then #J to join the filteredlines.It works but now I have file with hundreds of sentence of varying length.If I make a macro how will it know the number of words?
Sometimes I get a bounce back mail saying the e-mail address used wasn't valid. Is there a way to create a folder in "mail", and automatically sort these bounced back mails into this folder? Once this is done, how can I view these mails in a flat file manner? Am thinking of writing a script to parse through the mails to get the invalid e-mails all in one go.
View 3 Replies View RelatedI am parsing through XML documents with a PHP script and creating an array because, as far as I know, I can manipulate arrays better than the features DOM gives me. That part is not as important, though. The array it produces though is multi-dimensional, but somewhat inconsistent. If I have the following XML:
PHP Code:
<domains> <domain>
<title>google.com</title> <bookmarks>
<bookmark>maps.google.com</bookmark>
<bookmark>news.google.com</bookmark>
<bookmark>mail.google.com</bookmark>
</bookmarks> </domain> <domain>
<title>bankaccount.com</title>
<bookmarks> <bookmark>login.bankaccount.com</bookmark>
</bookmarks> </domain> </domains>
To call the first bookmark from the first domain, it would be:
PHP Code:
$array['domains']['domain'][0]['bookmarks']['bookmark'][0]
To call the first bookmark from the second domain, it would be:
PHP Code:
$array['domains']['domain'][1]['bookmarks']['bookmark']
The problem is, I want to simply call bookmarks through a simply 'foreach()' or 'for()' function and the lack of consistency might be a problem, but the fact that some levels have a '0' array key and others do not is causing a problem.