Hi,
I want to count how many rows are in a file for a specific column.
eg.
K NM
K NM
K NM
K JK
K NM
K JK
K NM
so the file is tab-delimited. I want to count how many rows are in column 2 and how many NMs there are.
I used awk
awk '{OFS="\t"}; {count++} {print i,... (3 Replies)
Hi to all.
I'm trying to sort this with the Unix command sort.
user1:12345678:3.5:2.5:8:1:2:3
user2:12345679:4.5:3.5:8:1:3:2
user3:12345687:5.5:2.5:6:1:3:2
user4:12345670:5.5:2.5:5:3:2:1
user5:12345671:2.5:5.5:7:2:3:1
I need to get this:
user3:12345687:5.5:2.5:6:1:3:2... (7 Replies)
Hello all -
I am to this forum and fairly new in learning unix and finding some difficulty in preparing a small shell script. I am trying to make script to sort all the files given by user as input (either the exact full name of the file or say the files matching the criteria like all files... (3 Replies)
sort --random-sort
The full command is
path=`find /testdir -maxdepth 1 -mindepth 1 -type d | ***Some sort of sort function*** | head -1`
I have a list I want to randomly sort. It works fine in ubuntu but on a 'osx lion' sort dosen't have the --random-sort option.
I don't want to... (5 Replies)
Input file:
100%ABC2 3.44E-12 USA
A2M%H02579 0E0 UK
100%ABC2 5.34E-8 UK
100%ABC2 3.25E-12 USA
A2M%H02579 5E-45 UK
Output file:
100%ABC2 3.44E-12 USA
100%ABC2 3.25E-12 USA
100%ABC2 5.34E-8 UK
A2M%H02579 0E0 UK
A2M%H02579 5E-45 UK
Code try:
sort -k1,1 -g -k2 -r input.txt... (2 Replies)
Hi Experts,
I have a filelist collected from another server , now want to sort the output using date/time stamp filed.
- Filed 6, 7,8 are showing the date/time/stamp.
Here is the input:
#----------------------------------------------------------------------
-rw------- 1 root ... (3 Replies)
Hi,
Could anyone kindly show me a link or explain the difference between
sort -n -k2 -k3 & sort -n -k2,3
Also, if I like to remove the row with repetition at both $2 and $3, Can I safely use
sort -u -k2 -k3
Example;
100 20 30
100 20 30
So, both $2 and $3 are same and I... (2 Replies)
How to sort the following output based on lowest to highest BE?
The following sort does not work.
$ sort -t. -k1,1n -k2,2n bfd.txt
BE31.116 0s 0s DOWN DAMP
BE31.116 0s 0s DOWN DAMP
BE31.117 0s 0s ... (7 Replies)
Discussion started by: sand1234
7 Replies
LEARN ABOUT HPUX
sdiff
sdiff(1) General Commands Manual sdiff(1)NAME
sdiff - side-by-side difference program
SYNOPSIS
[options ...] file1 file2
DESCRIPTION
uses the output of diff(1) with the option, which ignores trailing blanks (spaces and tabs) and treats other strings of blanks as equal, to
produce a side-by-side listing of two files, indicating those lines that are different. Each line of the two files is printed with a blank
gutter between them if the lines are identical, a in the gutter if the line only exists in file1, a in the gutter if the line only exists
in file2, and a for lines that are different.
For example:
abc | xyz
abc abc
bca <
cba <
dcb dcb
> cde
Options
recognizes the following options:
Use the next argument,
n, as the width of the output line. The maximum value of n is 2048 (LINE_MAX). The default line length is 130 charac-
ters.
Only print on the left side when lines are identical.
Do not print identical lines.
Use the next argument,
output, as the name of a third file that is created as a user-controlled merging of file1 and file2. Identical lines of
file1 and file2 are copied to output. Sets of differences, as produced by diff(1), are printed; where a set of differ-
ences share a common gutter character. After printing each set of differences, prompts the user with a and waits for
one of the following user-typed commands:
append the left column to the output file
append the right column to the output file
turn on silent mode; do not print identical lines
turn off silent mode
call the editor with the left column
call the editor with the right column
call the editor with the concatenation of left and right
call the editor with a zero length file
exit from the program
On exit from the editor, the resulting file is concatenated on the end of the output file.
EXAMPLES
Print a side-by-side diff of two versions of a file on a printer capable of printing 132 columns:
Retrieve the most recently checked in version of a file from RCS and compare it with the version currently checked out:
SEE ALSO diff(1), ed(1).
sdiff(1)