General :: Sorting Output By A Column With Numbers And Letters
May 22, 2011
I have a program that prints out lines like:
And I want to be able to pipe it to sort on that third column, by letter first, then number. But I keep coming getting files sorted like:
(field separations all start at same place, so columns are not jagged like above.)
I have read the sort man pages, and have tried -n for the numbers, and -k for the position to start sorting, among other things. I also tried inputting a second position to start sorting, which sort should supposedly refer to if the two entries are identical at the first place being compared, but it seems to just ignore the second one. I just can't get it to sort the numbers properly...
For now I am manually opening the file in emacs and changing them around, needless to say, very time consuming.
View 13 Replies
ADVERTISEMENT
Jul 13, 2011
I 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.
View 8 Replies
View Related
Aug 13, 2010
1. Given a string, row no. and col. no., I want to display it in the screen appropriately. how to do this?
2. How can I find the cpu processing time taken in carrying out the sorting task (any sorting program)?
View 4 Replies
View Related
Jun 3, 2010
Any way to show the permissions with numbers (777) instead of with letters (drwxrwxrwx) using "ls" command or any other command ?
View 2 Replies
View Related
Aug 12, 2010
I am trying to strip the numbers from the 5th columns and just get letters - in perl - i tried using subsrt, chop. and a regex -
what i want to get is:
i tired appending a regex perl -nle 'print /(w{1,20})d{1-20} but it did not work.
View 5 Replies
View Related
Mar 17, 2009
I just started programming in PHP so I haven't figured out how to do this yet, but I have a multi-dimensional array that I need to sort by one column. That's fine...but I need the sort to ignore case! Right now I have it sorted by 'name' (the other column is 'uid').
The problem is that by the default the sort is case-sensitive so the array looks like this:
Code:
Apple 4015
Banana 4011
Cherry 4045
avocado 4046
I want to be able to sort the the 'name' column in a case-insensitive manner so that the array actually looks like:
Code:
Apple 4015
avocado 4046
Banana 4011
Cherry 4045
How to accomplish this? Just FYI I'm not actually sorting the PLUs for fruits...but it was a simple example. I'm actually doing this for a Facebook application.
View 2 Replies
View Related
Jun 2, 2011
At first I apologize if the subject was in the wrong place
The reason is that I do not speak English
And enlisted Google to translate can I register and add this topic
I have a question:
Can I change the password to be one of three numbers or three letters only
I use ubuntu 10.04
Note: I know the old password I just want to change
View 6 Replies
View Related
Jun 8, 2010
I have just got a used computer from a friend and i installed Ubuntu because i am a new Linux user and i have heard its the simplest one to use but i installed to my computer as the only operating system and now when i start it up it says this: Error: No such devicea bunch of numbers and letters).
View 7 Replies
View Related
Jun 27, 2010
In M$ Word, if you press Alt+X, the letter behind the cursor will become a Unicode hexadecimal string. Where is that functionality in OpenOffice.org Writer?
View 1 Replies
View Related
May 19, 2010
I would like to know how to make a script that can check that i input 3 letters and 3 numbers in some field.
i am completely noob in this programming scene, but think its quite interesting.
View 13 Replies
View Related
Nov 20, 2010
I have a text file with 4 columns and 18 rows. All are integers. I wish to find the average of first 12 numbers in the third column using 'awk'.
View 8 Replies
View Related
Mar 30, 2010
How do I sort the output of du by its first column. I issue the command this way:$ du.Is there a way?
View 5 Replies
View Related
Aug 6, 2010
I did a system update earlier in the day, but I have a hard time thinking this is connected to it:
I shut down my computer and when I went to start it up, I got a black screen and a bunch of letters and numbers followed by:
Is there something I can do to get back to my desktop? Is there a way I can access my documents, at least?
View 2 Replies
View Related
Aug 28, 2010
I know what are hard and soft limits, but what means "blocks" column in edquota utility?
View 1 Replies
View Related
Apr 25, 2011
I was trying to redirect the output of two variables to different columns of a .csv file in MS excel like this,
Code:
echo "$a $b" > abc.csv
But I am getting both $a and $b in the same column, is there anything I can use instead of to move the value of $b to the next column? Or is there a good different approach to do it?
View 2 Replies
View Related
Oct 2, 2010
What I need to do is to extract one complete column (file size) from the output of ls -lS but while doing so in some rows I have a single space but in some other rows I have 2 or 3 spaces like some file sizes are different with 30 bytes 400 bytes and some 4000 bytes. So when I extract the output of ls using | cut -d ' ' -f5 i get the value which has only one space i.e. I get 4000 as output because 400 has 2 spaces seperated and 30 is 3 spaces separated. So how to get the file size column from the ls output?
View 10 Replies
View Related
May 13, 2011
Have this script which is reading in a series of files, one at a time with while-do-done loop, each file goes through various greps/awk's where this info is then saved to various files for later use. i.e....
Script is being run on Linux Red Hat,
In one of the grep/awk's the output (currently) are 2 columns (min max), i.e....| awk '{print $1, $2}' | sort -u which outputs (e.g.)
The number of "min max" pairs varies from file to file. Want to output a single column of unique numbers from the min max pairs & get the number of them for input to a file...i.e...
Where <PROCESS> is some process/technique that will generate a single column of integers (increment of 1) to pipe into the next one (sort -u)
i.e. (example from above)
Have tried command seq - only works for single pair input i.e.
Is there any command like seq etc which will output a single column based on a input of min max numbers (increment 1) to pipe onwards to next command?
View 4 Replies
View Related
Mar 12, 2010
I tried to add my wife , and when I put in a password for her, this error comes up."Please set a valid user name consisting of a lower case letter followed by lower case letters and numbers." I did all that and I still can't set a password for her.
View 3 Replies
View Related
Jul 19, 2010
How would i calculate following values.Initial file
10 3
20 4
How would i calculate 3rd column which should be addition of value in 1 and 2nd column.File after calculation
10 3 13
20 4 24
View 14 Replies
View Related
Mar 7, 2010
i use this script to get the time and date of back and fourth transactions for a particular execution id. I use a substr command on the 5th column to to cut the milli seconds off the time value. - otherwise the times would look like 08:30:04.235
grep <executionID> <auditfile> | awk '{ print $1, $2, $3, $4, substr($5,1,8}
FIX -> Mon 3/1/2010 08:30:04
FIX <- Mon 3/1/2010 08:32:36
FIX <- Mon 3/1/2010 08:35:08
[code].....
anyhow - i append two sed commands to further clarify the direction of the message.
awk '{ print $1, $2, $3, $4, substr($5,1,8} | sed -e 's/->/ ->IN/g' | sed -e 's/<-/<-OUT/g'
FIX -> IN Mon 3/1/2010 08:30:04
FIX <- OUT Mon 3/1/2010 08:32:36
[code]....
I tried using an awk gsub () command within the string instead of the two seds, but it did not work:
awk '{ print gsub(/<regex>/, <replace with>,$1), $2, $3, $4, substr($5,1,8}
the sed works ok, but it would be cooler to make the replacement within the awk command:
gsub(/->/,-> IN, $1)
Is there a way where i could replace the value of the $1 column in the awk print string?
View 1 Replies
View Related
Dec 12, 2010
Recently I faced a problem in typing in English in OpenSuse 11.3.When I try to type in English it shows me Greek letter and worse than that I think it is really Greek (not only in font) because when I enter my passwords or try to type a command in terminal I get error,I tested with UK and USA and all other English languages and I still have this problem. I even do reset in my keyboard layout setting and in KDE setting but it didn't help.
View 3 Replies
View Related
Jul 15, 2010
I have a multicolumn datas, like
a1 b1 ... f1
a2 b2 ... f2
. . ... .
[code]...
I would like to make a file with all these data in one column, like
a1
a2
.
.
[code]....
Can it be done with awk or some other command? Also, is it possible then do add another column in front of this one with numbers of the lines (for every previous column), like
1 a1
2 a2
. .
. .
[code].....
View 14 Replies
View Related
Jun 27, 2011
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
View 1 Replies
View Related
Jan 6, 2010
I have some files in a directory like
file1.txt
file10.txt
file2.txt
[code]...
View 5 Replies
View Related
Jun 22, 2011
I 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 Related
Apr 28, 2010
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
May 6, 2010
(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?
View 9 Replies
View Related
Apr 4, 2011
am writing a small search program for my class. I have decided to use indexing for my program. Ive researched online about indexing and how search engines do it. If im gonno do that I need to create inverted files to associate files to numbers ( numbers being the index of my paths ) . Now I was wondering what would be the best way to create an inverted file ? I was going to create sql tables using mysql api in C but then again there is no array data type or vectors to store few numbers in a single column in mysql and it is not advised to use Enum or SET
View 14 Replies
View Related
Feb 15, 2010
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 Related
Jul 30, 2011
I type characters with an overbar, like the NOT symbol in math, when in a linux SSH shell with no GUI?
View 3 Replies
View Related