Sponsored Content
Top Forums UNIX for Dummies Questions & Answers LINUX SORT command chops results Post 302618193 by Yahalom on Tuesday 3rd of April 2012 05:37:52 PM
Old 04-03-2012
LINUX SORT command chops results

I am trying to sort a file . The file looks like this:
Code:
DDFF 2 /ztpfrepos/pgr/load
DDFQ 2 /ztpfrepos/pgr/load
DDFX 2 /ztpfrepos/pgr/load
DDUA 2 /ztpfrepos/pgr/load

My command:
Code:
sort -k1 /home/c153507/Bin/OPL1.txt -o /home/c153507/Bin/OPL1.txt

The results are OK except for one line where the line is chopped in the middle:

Code:
EUXF 2 /ztpfrepos/pgr/load
EUXG 1 /ztpfrep
EUXG 2 /ztpfrepos/pgr/load

Can anyone think of a reason / fix ?

Thanks!!
Moderator's Comments:
Mod Comment Please use code tags for code, and refrain from excessive use of colors and fonts.

Last edited by Corona688; 04-03-2012 at 07:11 PM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to sort find results

Hi-- Ok. I have now found that: find -x -ls will do what I need as far as finding all files on a particular volume. Now I need to sort the results by the file's modification date/time. Is there a way to do that? Also, I notice that for many files, whereas the man for find says ls is... (8 Replies)
Discussion started by: groundlevel
8 Replies

2. UNIX for Dummies Questions & Answers

Linux Sort command

Hello! Can anybody explain in laymen terms what the (+) option in the sort command for Linux does? Please. Thanks in advance!!:D (1 Reply)
Discussion started by: itisijayare
1 Replies

3. Shell Programming and Scripting

Help with sort folder results

Here is the code, but the list is not sorted properly (alphabetically)? <?php function folderlist(){ $startdir = './'; $ignoredDirectory = '.'; $ignoredDirectory = '..'; if (is_dir($startdir)){ if ($dh = opendir($startdir)){ while (($folder = readdir($dh)) !== false){ if... (0 Replies)
Discussion started by: mrlayance
0 Replies

4. UNIX for Dummies Questions & Answers

linux sort command produces strange output

cat a .a ba .b bb .c bc sort a .a .b ba bb bc .c NOTE: .a and .b appears before ba and bb, where as .c appears after bc. In general (3 Replies)
Discussion started by: ajb
3 Replies

5. UNIX for Dummies Questions & Answers

sort find results

Hi, I have a problem with a shell script. The script should find all .cpp and .h files and list them. With: for file in `find $src -name '*.h' -o -name '*.cpp' it gives out this: H:\FileList\A\E\F\G\newCppFile.cpp H:\FileList\header01.h H:\FileList\B\nextCppFile.cpp ... (4 Replies)
Discussion started by: shellBeginner75
4 Replies

6. Linux

sort command in centos linux os

Iam working on centos os. Iam not able to sort records without option Please help me out Jayaprakash B. (1 Reply)
Discussion started by: jpachar
1 Replies

7. Homework & Coursework Questions

linux sort command

This is the question being asked: (Sort your data file by last name first, then by the first name second - save as first_last.) I am not quite sure of the type of sort I am being asked to perform. I have read the man pages of the sort command a few times, as well as searching online for possible... (10 Replies)
Discussion started by: demet8
10 Replies

8. UNIX for Advanced & Expert Users

Sort command results are different in Redhat 4 vs Redhat 5

Hi, I am having a text file with the following contents ########### File1 ########### some page1.txt text page.txt When I sort this file on Red Hat 5, then I get the following output ########### File1 ########### page1.txt page.txt some (3 Replies)
Discussion started by: sarbjit
3 Replies

9. UNIX for Beginners Questions & Answers

Strange sort -r results

Hi Folks - I have this file that looks like this: outbox/logs/Client_1042.log outbox/logs/Client_941.log outbox/logs/Client_942.log outbox/logs/Client_943.log outbox/logs/Client_944.log And this is my code: #!/bin/bash _OUTBOX_BIN="outbox/logs/" _NAME="Client" _TEMP="temp.txt"... (9 Replies)
Discussion started by: SIMMS7400
9 Replies

10. UNIX for Beginners Questions & Answers

Inconsistent results using sort function

Could you please advise on the following: I have two space-delimited files with 9 and 10 columns, respectively, with exactly the same values in column 1. However, the order of column 1 differs between the two files, so I want to sort both files by column 1, so that I can align them and... (6 Replies)
Discussion started by: aberg
6 Replies
Net::SNPP::Server(3pm)					User Contributed Perl Documentation				    Net::SNPP::Server(3pm)

NAME
Net::SNPP::Server - SNPP server library DESCRIPTION
An object interface for creating SNPP servers. Almost everything you need to create your very own SNPP server is here in this module. There is a callback() method that can replace default function with your own. them. Any SNPP command can be overridden or new/custom ones can be created using custom_command(). To disable commands you just don't want to deal with, use disable_command(). SYNOPSIS
There may be a synopsis here someday ... METHODS
new() Create a Net::SNPP::Server object listening on a port. By default, it only listens on the localhost (127.0.0.1) - specify MultiHomed to listen on all addresses or LocalAddr to listen on only one. my $svr = Net::SNPP::Server->new( Port => port to listen on BindTo => interface address to bind to MultiHomed => listen on all interfaces if true (and BindTo is unset) Listen => how many simultaneous connections to handle (SOMAXCONN) # the following two options are only used by handle_client() MaxErrors => maximum number of errors before disconnecting client Timeout => timeout while waiting for data (uses SIGARLM) ); client() Calls accept() for you and returns a client handle. This method will block if there is no waiting client. The handle returned is a subclass of IO::Handle, so all IO::Handle methods should work. my $client = $server->client(); ip() Return the IP address associated with a client handle. printf "connection from %s", $client->ip(); socket() Returns the raw socket handle. This mainly exists for use with select() or IO::Select. my $select = IO::Select->new(); $select->add( $server->socket() ); connected() For use with a client handle. True if server socket is still alive. shutdown() Shuts down the server socket. $server->shutdown(2); callback() Insert a callback into Server.pm. $server->callback( 'process_page', &my_function ); $server->callback( 'validate_pager_id', &my_function ); $server->callback( 'validate_pager_pin', &my_function ); $server->callback( 'write_log', &my_function ); $server->callback( 'create_id_and_pin', &my_function ); process_page( $PAGER_ID, \%PAGE, @RESULTS ) $PAGER_ID = [ 0 => retval of validate_pager_id 1 => retval of validate_pager_pin ] $PAGE = { mess => $, responses => [], } validate_pager_id( PAGER_ID ) The return value of this callback will be saved as the pager id that is passed to the process_page callback as the first list element of the first argument. validate_pager_pin( VALIDATED_PAGER_ID, PIN ) The value returned by this callback will be saved as the second list element in the first argument to process_page. The PAGER_ID input to this callback is the output from the validate_pager_id callback. NOTE: If you really care about the PIN, you must use this callback. The default callback will return 1 if the pin is not set. write_log First argument is a Unix syslog level, such as "warning" or "info." The rest of the arguments are the message. Return value is ignored. create_id_and_pin Create an ID and PIN for a 2way message. custom_command() Create a custom command or override a default command in handle_client(). The command name must be 4 letters or numbers. The second argument is a coderef that should return a text command, i.e. "250 OK" and some "defined" value to continue the client loop. +++If no value is set, the client will be disconnected after executing your command.+++ If you need MSTA or KTAG, this is the hook you need to implement them. The subroutine will be passed the command arguments, split on whitespace. sub my_MSTA_sub { my( $id, $password ) = @_; # ... return "250 OK", 1; } $server->custom_command( "MSTA", &my_MSTA_sub ); disable_command() Specify a command to disable in the server. This is useful, for instance, if you don't want to support level 3 commands. $server->disable_command( "2WAY", "550 2WAY not supported here" ); The second argument is an optional custom error message. The default is: "500 Command Not Implemented, Try Again" handle_client() Takes the result of $server->client() and takes care of parsing the user input. This should be quite close to being rfc1861 compli- ant. If you specified Timeout to be something other than 0 in new(), SIGARLM will be used to set a timeout. If you use this, make sure to take signals into account when writing your code. fork()'ing before calling handle_client is a good way to avoid interrupting code that shouldn't be interrupted. forked_server() Creates a server in a forked process. The return value is an array (or arrayref depending on context) containing a read-only pipe and the pid of the new process. Pages completed will be written to the pipe as a semicolon delimited array. my($pipe,$pid) = $server->forked_server(); my $line = $pipe->getline(); chomp( $line ); my( $pgr, $pgr, %pagedata ) = split( /;/, $line ); AUTHOR
Al Tobey <tobeya@tobert.org> Some ideas from Sendpage::SNPPServer Kees Cook <cook@cpoint.net> http://outflux.net/ TODO
Add more hooks for callbacks Implement the following level 2 and level 3 commands 4.5.1 LOGIn <loginid> [password] 4.5.3 LEVEl <ServiceLevel> 4.5.5 COVErage <AlternateArea> 4.5.7 CALLerid <CallerID> 4.6.3 EXPTag <hours> 4.6.5 ACKRead <0|1> 4.6.6 RTYPe <Reply_Type_Code> SEE ALSO
Net::Cmd Socket perl v5.8.8 2008-02-04 Net::SNPP::Server(3pm)
All times are GMT -4. The time now is 02:53 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy