Sponsored Content
Full Discussion: Sorting a text file
Top Forums Shell Programming and Scripting Sorting a text file Post 302412714 by anbu23 on Tuesday 13th of April 2010 10:04:58 AM
Old 04-13-2010
Include n option to get the correct results for sorting on integers
Code:
$ cat file
David:501
Albie:503
Shaun:502
Shaun:5000
Raj:1
John:11
Chuck:111
$ sort -t: -r +1 file
Albie:503
Shaun:502
David:501
Shaun:5000
Chuck:111
John:11
Raj:1
$ sort -r -t":" -k2 file
Albie:503
Shaun:502
David:501
Shaun:5000
Chuck:111
John:11
Raj:1
$ sort -t: -nrk2 file
Shaun:5000
Albie:503
Shaun:502
David:501
Chuck:111
John:11
Raj:1

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Sorting rules on a text section

Hi all My text file looks like this: start doc ... (certain number of records) REC3|Emma|info| REC3|Lukas|info| REC3|Arthur|info| ... (certain number of records) end doc start doc ... (certain number of records)... (4 Replies)
Discussion started by: Indalecio
4 Replies

2. Shell Programming and Scripting

awk error in sorting text file

Hi Having a file as below file.txt error Server Network Name Dept Date Time =========================================================================================================================== 0 ServerA LAN1 AAA IT01 04/30/2008 09:16:26 0 ... (3 Replies)
Discussion started by: karthikn7974
3 Replies

3. UNIX for Dummies Questions & Answers

sorting files with find command before sending to text file

i need help with my script.... i am suppose to grab files within a certain date range now i have done that already using the touch and find command (found them in other threads) touch -d "$date_start" ./tmp1 touch -d "$date_end" ./tmp2 find "$data_location" -maxdepth 1 -newer ./tmp1 !... (6 Replies)
Discussion started by: deking
6 Replies

4. Shell Programming and Scripting

Group on the basis of common text in the square bracket and sorting

File A 99 >ac >ss >juk 70 >acb >defa 90 >ca 100 >aa >abc >bca 85 >cde 81 >ghi >ghij 87 >def >fgh <ijk 89 >fck >ghij >kill >aa The given output shud be 100 >aa >abc >bca 87 >def >fgh <ijk 89 >fck >ghij >kill >aa (2 Replies)
Discussion started by: cdfd123
2 Replies

5. Shell Programming and Scripting

sorting based on a specified column in a text file

I have a tab delimited file with 5 columns 79 A B 20.2340 6.1488 8.5086 1.3838 87 A B 0.1310 0.0382 0.0054 0.1413 88 A B 46.1651 99.0000 21.8107 0.2203 89 A B 0.1400 0.1132 0.0151 0.1334 114 A B 0.1088 0.0522 0.0057 0.1083 115 A B... (2 Replies)
Discussion started by: Lucky Ali
2 Replies

6. UNIX Desktop Questions & Answers

Problem in sorting a text file

Hi; I have a text file like this: 1 10 11 2 3 4 M X Y When I sort it numerically using sort -n, it looks like this: Y X M 1 2 3 4 10 (3 Replies)
Discussion started by: a_bahreini
3 Replies

7. Shell Programming and Scripting

Complex data sorting in excel files or text files

Dear all, I have a complex data file shown below,,,,, A_ABCD_13208 0 0 4.16735 141044 902449 1293900 168919 C_ABCD_13208 0 0 4.16735 141044 902449 1293900 168919 A_ABCDEF715 52410.9 18598.2 10611 10754.7 122535 252426 36631.4 C_DBCDI_1353 0... (19 Replies)
Discussion started by: AAWT
19 Replies

8. Shell Programming and Scripting

Sorting indented text files

Hello, I'm trying to find a solution or a proper tool for the following job: I need to sort a text document with indented sections, so all levels of indentation are sorted independently for each section. Particularly, I need this for Cisco routers' running config files to compare them with... (2 Replies)
Discussion started by: kobel
2 Replies

9. Shell Programming and Scripting

Sorting a text file with respect to Function/Keyword

Hello Experts, I am truly a beginner in shell and perl . Need an urgent help with sorting a file. please help. wouldn't mind whether in perl or shell script. Here are the details. ------------------------------------------------------ Input Text file EX:... (9 Replies)
Discussion started by: pradyumnajpn10
9 Replies

10. Shell Programming and Scripting

Match text to lines in a file, iterate backwards until text or text substring matches, print to file

hi all, trying this using shell/bash with sed/awk/grep I have two files, one containing one column, the other containing multiple columns (comma delimited). file1.txt abc12345 def12345 ghi54321 ... file2.txt abc1,text1,texta abc,text2,textb def123,text3,textc gh,text4,textd... (6 Replies)
Discussion started by: shogun1970
6 Replies
TORSOCKS(8)						      System Manager's Manual						       TORSOCKS(8)

NAME
torsocks - Library for intercepting outgoing network connections and redirecting them through a SOCKS server. SYNOPSIS
Set LD_PRELOAD to load the library then use applications as normal The syntax to force preload of the library for different shells is specified below: Bash, Ksh and Bourne shell - export LD_PRELOAD=/lib/libtorsocks.so C Shell - setenv LD_PRELOAD=/lib/libtorsocks.so This process can be automated (for Bash, Bourne and Korn shell users) for a single command or for all commands in a shell session by using the torsocks(1) script You can also setup torsocks in such a way that all processes automatically use it, a very useful configuration. For more information on this configuration see the CAVEATS section of this manual page. DESCRIPTION
torsocks is a library to allow transparent SOCKS proxying. It wraps the normal connect() function. When a connection is attempted, it con- sults the configuration file (which is defined at configure time but defaults to /etc/torsocks.conf) and determines if the IP address spec- ified is local. If it is not, the library redirects the connection to a SOCKS server specified in the configuration file. It then negoti- ates that connection with the SOCKS server and passes the connection back to the calling program. torsocks is designed for use in machines which are firewalled from then internet. It avoids the need to recompile applications like lynx or telnet so they can use SOCKS to reach the internet. It behaves much like the SOCKSified TCP/IP stacks seen on other platforms. ARGUMENTS Most arguments to torsocks are provided in the configuration file (the location of which is defined at configure time by the --with-conf=<file> argument but defaults to /etc/torsocks.conf). The structure of this file is documented in torsocks.conf(8) Some configuration options can be specified at run time using environment variables as follows: TORSOCKS_CONFFILE This environment variable overrides the default location of the torsocks configuration file. This variable is not honored if the program torsocks is embedded in is setuid. In addition this environment variable can be compiled out of torsocks with the --dis- able-envconf argument to configure at build time TORSOCKS_DEBUG This environment variable sets the level of debug output that should be generated by torsocks (debug output is generated in the form of output to standard error). If this variable is not present by default the logging level is set to 0 which indicates that only error messages should be output. Setting it to higher values will cause torsocks to generate more messages describing what it is doing. If set to -1 torsocks will output absolutely no error or debugging messages. This is only needed if torsocks output inter- feres with a program it is embedded in. Message output can be permanently compiled out of torsocks by specifying the --disable-debug option to configure at build time TORSOCKS_DEBUG_FILE This option can be used to redirect the torsocks output (which would normally be sent to standard error) to a file. This variable is not honored if the program torsocks is embedded in is setuid. For programs where torsocks output interferes with normal operation this option is generally better than disabling messages (with TORSOCKS_DEBUG = -1) TORSOCKS_USERNAME This environment variable can be used to specify the username to be used when version 5 SOCKS servers request username/password authentication. This overrides the default username that can be specified in the configuration file using 'default_user', see tor- socks.conf(8) for more information. This variable is ignored for version 4 SOCKS servers. TORSOCKS_PASSWORD This environment variable can be used to specify the password to be used when version 5 SOCKS servers request username/password authentication. This overrides the default password that can be specified in the configuration file using 'default_pass', see tor- socks.conf(8) for more information. This variable is ignored for version 4 SOCKS servers. DNS ISSUES torsocks will normally not be able to send DNS queries through a SOCKS server since SOCKS V4 works on TCP and DNS normally uses UDP. Ver- sion 1.5 and up do however provide a method to force DNS lookups to use TCP, which then makes them proxyable. This option can only enabled at compile time, please consult the INSTALL file for more information. ERRORS torsocks will generate error messages and print them to stderr when there are problems with the configuration file or the SOCKS negotiation with the server if the TORSOCKS_DEBUG environment variable is not set to -1 or and --disable-debug was not specified at compile time. This output may cause some problems with programs that redirect standard error. CAVEATS torsocks will not in the above configuration be able to provide SOCKS proxying to setuid applications or applications that are not run from a shell. You can force all applications to LD_PRELOAD the library by placing the path to libtorsocks in /etc/ld.so.preload. Please make sure you correctly enter the full path to the library in this file if you do this. If you get it wrong, you will be UNABLE TO DO ANYTHING with the machine and will have to boot it with a rescue disk and remove the file (or try the saveme program, see the INSTALL file for more info). THIS IS A ***WARNING***, please be careful. Also be sure the library is in the root filesystem as all hell will break loose if the directory it is in is not available at boot time. BUGS
torsocks can only proxy outgoing TCP connections torsocks does NOT work correctly with asynchronous sockets (though it does work with non blocking sockets). This bug would be very diffi- cult to fix and there appears to be no demand for it (I know of no major application that uses asynchronous sockets) torsocks is NOT fully RFC compliant in its implementation of version 5 of SOCKS, it only supports the 'username and password' or 'no authentication' authentication methods. The RFC specifies GSSAPI must be supported by any compliant implementation. I haven't done this, anyone want to help? torsocks can force the libc resolver to use TCP for name queries, if it does this it does it regardless of whether or not the DNS to be queried is local or not. This introduces overhead and should only be used when needed. torsocks uses ELF dynamic loader features to intercept dynamic function calls from programs in which it is embedded. As a result, it can- not trace the actions of statically linked executables, non-ELF executables, or executables that make system calls directly with the system call trap or through the syscall() routine. FILES
/etc/torsocks.conf - default torsocks configuration file SEE ALSO
torsocks.conf(5) torsocks(1) usewithtor(1) AUTHOR
Shaun Clowes (delius@progsoc.uts.edu.au) COPYRIGHT
Copyright 2000 Shaun Clowes Renamed for use by torsocks to avoid conflict with tsocks by Robert Hogan. torsocks and its documentation may be freely copied under the terms and conditions of version 2 of the GNU General Public License, as pub- lished by the Free Software Foundation (Cambridge, Massachusetts, United States of America). This documentation is based on the documentation for logwrites, another shared library interceptor. One line of code from it was used in torsocks and a lot of the documentation :) logwrites is by adam@yggdrasil.com (Adam J. Richter) and can be had from ftp.yggdrasil.com pub/dist/pkg Shaun Clowes TORSOCKS(8)
All times are GMT -4. The time now is 08:54 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy