Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Sort alphabetically starting from specified letter Post 302958345 by joeyg on Wednesday 21st of October 2015 11:25:11 AM
Old 10-21-2015
What if you broke the file into two (fileAW and fileXZ) , based on a <="X" for the first field.
Sort fileAW to fileAWs
Sort fileXZ to fileXZs
then concatenate the files, combining fileXZs and fileAWs
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Sum of Files Sizes starting with a letter...

Can we find some of size of all files in a directry where file names start with an letter t* the out put of ls -ls t* is 4 -rw-r--r-- 1 root system 61 Jul 03 10:56 t 4 -rw-r--r-- 1 root system 3146 Jul 19 11:11 t1 4 -rw-r--r-- 1 root system ... (2 Replies)
Discussion started by: pbsrinivas
2 Replies

2. UNIX for Dummies Questions & Answers

How to sort alphabetically after finding values

I have a list of people in a usage log and need to print the names and phone numbers of people with over 500 logins. I'd also like to display these names alphabetically. I have their total logins set to a variable named total. So far, I have very little in my awk script to do this: FS=":"... (4 Replies)
Discussion started by: doubleminus
4 Replies

3. UNIX for Dummies Questions & Answers

Sort file alphabetically AND numerically

Hi all. I have 2 files like this: f1 A 10 B 80 C 9 f2 A 11 B 700 C 10 What I want is the concatenation of the two files sorted by name (alphabetically) and size (numerically), so the result should be like this: F3 (cat f1 f2 sorted) A 10 A 11 B 80 B 700 (2 Replies)
Discussion started by: mrodrig
2 Replies

4. UNIX for Dummies Questions & Answers

sort lines in different files based on the starting letter

Hi ,, i have the below file... D 2342135 B 214236 C argjlksd V lskjrghaklsr C slkrgj B sdg4tsd E aslkgjlkasg i want to sort the lines into different files based on the starting letter of the line. so that i have different files for lines starting with a letter. thanks (1 Reply)
Discussion started by: jathin12
1 Replies

5. Shell Programming and Scripting

Sort by numbers, then alphabetically

Hey guys, I have a file that contains the following: 366 K 364 Q 12 UB 7 INC. P 4 Law 2 LAMB 2 High 1 QEG 1 OF 1 LC 1 B As you can see, it's already sorted by numerical order, how do I sort it again, breaking the ties by using the alphabetical order of the second column, but... (2 Replies)
Discussion started by: Andrew9191
2 Replies

6. Shell Programming and Scripting

Sort alphabetically, then numerically

Greetings - I'm not necessarily new to bash scripting - I'm probably between beginner and intermediate, but I have something that I just cannot figure out after many attempts to find it. I have a file that is merely a list of many files, with their respective paths, and a branch path (ClearCase)... (5 Replies)
Discussion started by: 1cor29
5 Replies

7. Homework & Coursework Questions

Grep for filetype starting with letter p

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Which files in /usr/bin whose names begin with “p” are python scripts? Store the numbered results in... (3 Replies)
Discussion started by: alindner
3 Replies

8. Shell Programming and Scripting

Get all File names starting with letter P

Hi, I have lets say 10 files , I need to process them one by one. So I need a command to get one file name at a time to process it into a variable Example Files P1111.dat P3344.dat S344.dat ... v_file_name = 'p111.dat' .. I will rename it to something after processing ... (1 Reply)
Discussion started by: prassu
1 Replies

9. UNIX for Dummies Questions & Answers

[Solved] Reverse the order of a list of file names (but not sort them alphabetically or numerically)

Hello all, I have a list of file names in a text document where each file name consists of 4 letters and 3 numbers (for example MACR119). There are 48 file names in the document (they are not in alphabetical or numerical order). I would like to reorder the list of names so that the 48th name is... (3 Replies)
Discussion started by: MDeBiasse
3 Replies

10. Shell Programming and Scripting

Using awk to sort a file alphabetically

I have a problem with my homework I need to create a shell script using #!bin/awk -f the script will output the file in an alphabetical order only words and after the word is : after that a space then , then it will be numbered each character by which line its been for example CB 92A A... (1 Reply)
Discussion started by: collapse
1 Replies
MONGOCURSOREXCEPTION(3) 						 1						   MONGOCURSOREXCEPTION(3)

The MongoCursorException class

INTRODUCTION
Caused by accessing a cursor incorrectly or a error receiving a reply. Note that this can be thrown by any database request that receives a reply, not just queries. Writes, commands, and any other operation that sends information to the database and waits for a response can throw a MongoCursorException. The only exception is new MongoClient() (creating a new connection), which will only throw MongoConnectionEx- ceptions. This returns a specific error message to help diagnose the problem and a numeric error code associated with the cause of the exception. For example, suppose you tried to insert two documents with the same _id: <?php try { $collection->insert(array("_id" => 1), array("w" => 1)); $collection->insert(array("_id" => 1), array("w" => 1)); } catch (MongoCursorException $e) { echo "error message: ".$e->getMessage()." "; echo "error code: ".$e->getCode()." "; } ?> error message: E11000 duplicate key error index: foo.bar.$_id_ dup key: { : 1 } error code: 11000 The following is a list of common errors, codes, and causes. Exact errors are in italics, errors where the message can vary are described in obliques. o cannot modify cursor after beginning iteration Code: 0 You are calling a method that sets up the query after executing the query. Reset the cursor and try again. An example: <?php try { $cursor = $collection->find(); var_dump($cursor->getNext()); // getNext() queried the database, it's too late to set a limit $cursor->limit(1); } catch (MongoCursorException $e) { echo "error message: ".$e->getMessage()." "; echo "error code: ".$e->getCode()." "; } // this will work, though: $cursor->getNext(); $cursor->reset(); $cursor->limit(1); ?> o Get next batch send errors Code: 1 Could not send the query to the database. Make sure the database is still up and the network is okay. o cursor not found Code: 2 The driver was trying to fetch more results from the database, but the database did not have a record of the query. This usually means that the cursor timed out on the server side: after a few minutes of inactivity, the database will kill a cursor (see MongoCursor.immortal(3) for information on preventing this). An example: <?php try { $cursor = $collection->find(); $cursor->getNext(); // sleep for 15 minutes sleep(60*15); while ($cursor->hasNext()) { $cursor->getNext(); } } catch (MongoCursorException $e) { echo "error message: ".$e->getMessage()." "; echo "error code: ".$e->getCode()." "; } ?> o cursor->buf.pos is null Code: 3 This may indicate you are out of RAM or some other extraordinary circumstance. o couldn't get response header Code: 4 A common error if the database or network goes down. This means that the driver couldn't get a response from the connection. o no db response Code: 5 This may not even be an error, for example, the database command "shutdown" returns no response. However, if you were expecting a response, this means the database didn't give one. o bad response length: %d, did the db assert? Code: 6 This means that the database said that its response was less than 0. This error probably indicates a network error or database corruption. o incomplete header Code: 7 Highly unusual. Occurs if the database response started out correctly, but broke off in the middle. Probably indicates a network problem. o incomplete response Code: 8 Highly unusual. Occurs if the database response started out correctly, but broke off in the middle. Probably indicates a network problem. o couldn't find a response Code: 9 If the response was cached and now cannot be located. o error getting socket Code: 10 The socket was closed or encountered an error. The driver should automatically reconnect (if possi- ble) on the next operation. o couldn't find reply, please try again Code: 11 The driver saves any database responses it cannot immediately match with a request. This exception occurs if the driver has already passed your request's response and cannot find your response in its cache. o error getting database response: errstr WSA error getting database response: errstr "errstr" is an io error reported directly from the C socket subsystem. On Windows, the error message is prefixed with "WSA". o Timeout error Code: 13 If there was an error while waiting for a query to complete. o couldn't send query: <various> Code: 14 C socket error on send. o max number of retries exhausted, couldn't send query Code: 19 The driver will automatically retry "plain" queries (not commands) a couple of times if the first attempt failed for certain reasons. This is to cause fewer exceptions during replica set failover (although you will probably still have to deal with some) and gloss over transient network issues. This can also be caused by the driver not being able to reconnect at all to the database (if, for example, the database is unreachable). Version 1.2.2+. ERRORS PASSED THROUGH BY THE DATABASE
Database errors should always trigger MongoCursorExceptions on queries. Error messages and codes are sent directly from the database and you should be able to see matching errors in the database log. A few common database errors are listed below: o E11000 duplicate key error index: foo.bar.$X dup key: { /* ... */ } Code: 11000 Database error for duplicate keys. o not master Codes: 10107, 13435, and 10058 Not master errors, piped through by the database. ach of these will cause the driver to disconnect and attempt to find a new primary. The actual error you get on failover may not be a "not master" error, depending on when the change in primary occurs. CLASS SYNOPSIS
MongoCursorException MongoCursorExceptionextends MongoException PHP Documentation Group MONGOCURSOREXCEPTION(3)
All times are GMT -4. The time now is 07:37 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy