Hello all,
I have a txt file containing millions of lines. Below is the example:
There are empty lines which I take off using "sed 's/^$/d' file.txt"
Now the problem is, I want to find number of uniq values on the binary field. Here is what I want:
in the binary values, I was to find how many times the uniq values in field [57:50] are occuring. (MSB -> 125, LSB -> 0). There are total 126 bits in the lines.
I have sorted the files using sort:
As you can see, the files are sorted based on the fields that I am interested in. Now I am not sure how to find the Number of occurence (uniq) in those fields.
I have tried the uniq command, but surely it doesn't help:
What I am looking for in output is perhaps: (i am randomly putting values here)
I think the 'uniq' command should be ok, but I am open to anything.
If I understand your file contents (from your two examples) and assuming that the 1st field in your input is not always Instr1:, you might want to try this slight modification to RudiC's suggestion:
If file.txt contains you 1st sample (unsorted with blanks lines) and file2.txt contains your 2nd sample (sorted with no blank lines), the above script when invoked without operands produces the output:
and, if it is invoked with the operand file2.txt, produces the output:
This was written and tested using a Korn shell, but will work with any shell that uses Bourne shell syntax and understands the parameter expansions required by the POSIX standards (such as bash, dash, ksh, and zsh).
If you want to try this on a Solaris/SunOS system, change awk to /usr/xpg4/bin/awk or nawk.
This User Gave Thanks to Don Cragun For This Post:
I have a file containing multiple values, some of them are pipe separated which are to be read as separate values and some of them are single value all are these need to store in variables.
I need to read this file which is an input to my script
Config.txt
file name, first path, second... (7 Replies)
Hello,
I extracted a list of files in a directory with the command ls . However this is not my computer, so the ls functionality has been revamped so that it gives the filesizes in front like this :
This is the output of ls command : I stored the output in a file filelist
1.1M... (5 Replies)
I have a text file which is a dataset. and I need to convert it into a CSV format
The file is as follows :
First line :
-1 3:1 11:1 14:1 19:1 39:1 42:1 55:1 64:1 67:1 73:1 75:1 76:1 80:1 83:1
Second line "
+1 5:1 11:1 15:1 32:1 39:1 40:1 52:1 63:1 67:1 73:1 74:1 76:1 78:1 83:1
There are a... (6 Replies)
Hi All,
Is there any command which can convert binary decimal coded values to ascii values...
i have bcd values like below
оооооооооооо0о-- -v -
Pls suggest a way to convert this.
Thanks,
Deepti.Gaur (3 Replies)
Hello!
There is a text file, that contains hierarchy of menues, like:
Aaaaa->Bbbbb
Aaaaa->Cccc
Aaaaa-> {spaces} Ddddd (it means that the full path is Aaaaa->Cccc->Ddddd )
Aaaaa-> {more spaces} Eeeee (it means that the full path is Aaaaa->Cccc->Ddddd->Eeeee )
Fffffff->Ggggg... (1 Reply)
Hi all,
I have a print control file (dflt) for Oracle which is in binary. As I am going to develope an application in Window environment, I would like to reference the dflt file. But it is in binary format and I cannot access it. Anyone can suggest me how to convert the file into text or... (5 Replies)
Dear Sir;
i want to know how the binary data convert to text file or readablw format (ASCII).If possible pl. help me for the software and where it is available for download. i.e. (1 Reply)
A file contains one name per line, such as:
john doe
jack bruce
nancy smith
sam riley
When I 'cat' the file, the white space is treated as a new line. For example
list=`(cat /path/to/file.txt)`
for items in $list
do
echo $items
done
I get:
john
doe (1 Reply)
Hi ,
i'm using special binary file (lotus notes) and modifying an hexadecimal address range with windows hex editor and it works fine !
The file is an AIX one and i'm forced to transfert (ftp) it before modifying it and re-transfert !
NOW i would do this directly under AIX !
I can... (4 Replies)