Sponsored Content
Top Forums Shell Programming and Scripting Sort a file line by line alphabetically Post 302165901 by H2OBoodle on Saturday 9th of February 2008 07:09:13 PM
Old 02-09-2008
I responded to your question but I included a link, so I guess it's being held up for administrator review. Anyway, I've tried "sort" and some awk, but still no joy.
 

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. Shell Programming and Scripting

[Solved] Problem in reading a file line by line till it reaches a white line

So, I want to read line-by-line a text file with unknown number of files.... So: a=1 b=1 while ; do b=`sed -n '$ap' test` a=`expr $a + 1` $here do something with b etc done the problem is that sed does not seem to recognise the $a, even when trying sed -n ' $a p' So, I cannot read... (3 Replies)
Discussion started by: hakermania
3 Replies

5. 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

6. Shell Programming and Scripting

Sort a line and Insert sorted word(s) in a line

Hello, I am looking to automate a task - which is updating an existing access control instruction of a server and making sure that the attributes defined in the instruction is in sorted order. The instructions will be of a specific syntax. For example lets assume below listed is one of an... (6 Replies)
Discussion started by: sanjayroc
6 Replies

7. 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

8. Shell Programming and Scripting

Need a program that read a file line by line and prints out lines 1, 2 & 3 after an empty line...

Hello, I need a program that read a file line by line and prints out lines 1, 2 & 3 after an empty line... An example of entries in the file would be: SRVXPAPI001 ERRO JUN24 07:28:34 1775 REASON= 0000, PROCID= #E506 #1065: TPCIPPR, INDEX= 003F ... (8 Replies)
Discussion started by: Ferocci
8 Replies

9. 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

10. UNIX for Dummies Questions & Answers

Sort alphabetically starting from specified letter

Hi. I'm trying to sort a list of items in a file alphabetically but starting from the letter 'X'. For instance if I had the following file; test.txt Z A T W Y B S X I would like the output to look like; X Y (8 Replies)
Discussion started by: mmab
8 Replies
JOY(4)							   BSD Kernel Interfaces Manual 						    JOY(4)

NAME
joy -- game adapter driver SYNOPSIS
joy* at acpi? joy* at eap? joy* at eso? joy0 at isa? port 0x201 joy* at isapnp? joy* at ofisa? joy* at pci? joy* at pnpbios? index ? DESCRIPTION
This driver provides access to the game adapter. The lower bit in the minor device number selects the joystick: 0 is the first joystick and 1 is the second. The game control adapter allows up to two joysticks to be attached to the system. The adapter plus the driver convert the present resistive value to a relative joystick position. On receipt of an output signal, four timing circuits are started. By determining the time required for the circuit to time-out (a function of the resistance), the paddle position can be determined. The adapter could be used as a general purpose I/O card with four analog (resistive) inputs plus four digital input points. Applications may call ioctl(2) on a game adapter driver file descriptor to set and get the offsets of the two potentiometers and the maximum time-out value for the circuit. The ioctl(2) commands are listed in <machine/joystick.h> and currently are: JOY_SETTIMEOUT Sets the maximum time-out for the adapter. JOY_GETTIMEOUT Returns the current maximum time-out. JOY_SET_X_OFFSET Sets an offset on X value. JOY_GET_X_OFFSET Returns the current X offset. JOY_SET_Y_OFFSET Sets an offset on Y value. JOY_GET_Y_OFFSET Returns the current Y offset. All these commands take an integer parameter. read(2) on the file descriptor returns a joystick structure: struct joystick { int x; int y; int b1; int b2; }; The fields have the following functions: x current X coordinate of the joystick (or position of paddle 1) y current Y coordinate of the joystick (or position of paddle 2) b1 current state of button 1 b2 current state of button 2 The b1 and b2 fields in struct joystick are set to 1 if the corresponding button is down, 0 otherwise. The x and y coordinates are supposed to be between 0 and 255 for a good joystick and a good adapter. Unfortunately, because of the hardware hack that is used to measure the position (by measuring the time needed to discharge an RC circuit made from the joystick's potentiometer and a capacitor on the adapter), calibration is needed to determine exactly what values are returned for a specific joystick/adapter combination. Incorrect hardware can yield negative or values greater than 255. A typical calibration procedure uses the values returned at lower left, center and upper right positions of the joystick to compute the rela- tive position. This calibration is not part of the driver. FILES
/dev/joy0 first joystick /dev/joy1 second joystick SEE ALSO
acpi(4), eap(4), eso(4), isa(4), isapnp(4), ofisa(4), pci(4), pnpbios(4) AUTHORS
Jean-Marc Zucconi wrote the FreeBSD driver. Matthieu Herrb ported it to NetBSD and wrote this manual page. BSD
July 22, 2006 BSD
All times are GMT -4. The time now is 10:31 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy